Java Code Examples for org.apache.flink.runtime.deployment.InputGateDeploymentDescriptor#getShuffleDescriptors()

The following examples show how to use org.apache.flink.runtime.deployment.InputGateDeploymentDescriptor#getShuffleDescriptors() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SingleInputGateFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an input gate and all of its input channels.
 */
public SingleInputGate create(
		@Nonnull String owningTaskName,
		@Nonnull InputGateDeploymentDescriptor igdd,
		@Nonnull PartitionProducerStateProvider partitionProducerStateProvider,
		@Nonnull InputChannelMetrics metrics) {
	SupplierWithException<BufferPool, IOException> bufferPoolFactory = createBufferPoolFactory(
		networkBufferPool,
		isCreditBased,
		networkBuffersPerChannel,
		floatingNetworkBuffersPerGate,
		igdd.getShuffleDescriptors().length,
		igdd.getConsumedPartitionType());

	SingleInputGate inputGate = new SingleInputGate(
		owningTaskName,
		igdd.getConsumedResultId(),
		igdd.getConsumedPartitionType(),
		igdd.getConsumedSubpartitionIndex(),
		igdd.getShuffleDescriptors().length,
		partitionProducerStateProvider,
		isCreditBased,
		bufferPoolFactory);

	createInputChannels(owningTaskName, igdd, inputGate, metrics);
	return inputGate;
}
 
Example 2
Source File: SingleInputGateFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
private void createInputChannels(
		String owningTaskName,
		InputGateDeploymentDescriptor inputGateDeploymentDescriptor,
		SingleInputGate inputGate,
		InputChannelMetrics metrics) {
	ShuffleDescriptor[] shuffleDescriptors = inputGateDeploymentDescriptor.getShuffleDescriptors();

	// Create the input channels. There is one input channel for each consumed partition.
	InputChannel[] inputChannels = new InputChannel[shuffleDescriptors.length];

	ChannelStatistics channelStatistics = new ChannelStatistics();

	for (int i = 0; i < inputChannels.length; i++) {
		inputChannels[i] = createInputChannel(
			inputGate,
			i,
			shuffleDescriptors[i],
			channelStatistics,
			metrics);
		ResultPartitionID resultPartitionID = inputChannels[i].getPartitionId();
		inputGate.setInputChannel(resultPartitionID.getPartitionId(), inputChannels[i]);
	}

	LOG.debug("{}: Created {} input channels ({}).",
		owningTaskName,
		inputChannels.length,
		channelStatistics);
}
 
Example 3
Source File: SingleInputGateFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an input gate and all of its input channels.
 */
public SingleInputGate create(
		@Nonnull String owningTaskName,
		int gateIndex,
		@Nonnull InputGateDeploymentDescriptor igdd,
		@Nonnull PartitionProducerStateProvider partitionProducerStateProvider,
		@Nonnull InputChannelMetrics metrics) {
	SupplierWithException<BufferPool, IOException> bufferPoolFactory = createBufferPoolFactory(
		networkBufferPool,
		networkBuffersPerChannel,
		floatingNetworkBuffersPerGate,
		igdd.getShuffleDescriptors().length,
		igdd.getConsumedPartitionType());

	BufferDecompressor bufferDecompressor = null;
	if (igdd.getConsumedPartitionType().isBlocking() && blockingShuffleCompressionEnabled) {
		bufferDecompressor = new BufferDecompressor(networkBufferSize, compressionCodec);
	}

	SingleInputGate inputGate = new SingleInputGate(
		owningTaskName,
		gateIndex,
		igdd.getConsumedResultId(),
		igdd.getConsumedPartitionType(),
		igdd.getConsumedSubpartitionIndex(),
		igdd.getShuffleDescriptors().length,
		partitionProducerStateProvider,
		bufferPoolFactory,
		bufferDecompressor,
		networkBufferPool);

	createInputChannels(owningTaskName, igdd, inputGate, metrics);
	return inputGate;
}
 
Example 4
Source File: SingleInputGateFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
private void createInputChannels(
		String owningTaskName,
		InputGateDeploymentDescriptor inputGateDeploymentDescriptor,
		SingleInputGate inputGate,
		InputChannelMetrics metrics) {
	ShuffleDescriptor[] shuffleDescriptors = inputGateDeploymentDescriptor.getShuffleDescriptors();

	// Create the input channels. There is one input channel for each consumed partition.
	InputChannel[] inputChannels = new InputChannel[shuffleDescriptors.length];

	ChannelStatistics channelStatistics = new ChannelStatistics();

	for (int i = 0; i < inputChannels.length; i++) {
		inputChannels[i] = createInputChannel(
			inputGate,
			i,
			shuffleDescriptors[i],
			channelStatistics,
			metrics);
	}
	inputGate.setInputChannels(inputChannels);

	LOG.debug("{}: Created {} input channels ({}).",
		owningTaskName,
		inputChannels.length,
		channelStatistics);
}