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

The following examples show how to use org.apache.flink.runtime.deployment.InputGateDeploymentDescriptor#getConsumedResultId() . 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: NettyShuffleEnvironment.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<SingleInputGate> createInputGates(
		ShuffleIOOwnerContext ownerContext,
		PartitionProducerStateProvider partitionProducerStateProvider,
		Collection<InputGateDeploymentDescriptor> inputGateDeploymentDescriptors) {
	synchronized (lock) {
		Preconditions.checkState(!isClosed, "The NettyShuffleEnvironment has already been shut down.");

		MetricGroup networkInputGroup = ownerContext.getInputGroup();
		@SuppressWarnings("deprecation")
		InputChannelMetrics inputChannelMetrics = new InputChannelMetrics(networkInputGroup, ownerContext.getParentGroup());

		SingleInputGate[] inputGates = new SingleInputGate[inputGateDeploymentDescriptors.size()];
		int counter = 0;
		for (InputGateDeploymentDescriptor igdd : inputGateDeploymentDescriptors) {
			SingleInputGate inputGate = singleInputGateFactory.create(
				ownerContext.getOwnerName(),
				igdd,
				partitionProducerStateProvider,
				inputChannelMetrics);
			InputGateID id = new InputGateID(igdd.getConsumedResultId(), ownerContext.getExecutionAttemptID());
			inputGatesById.put(id, inputGate);
			inputGate.getCloseFuture().thenRun(() -> inputGatesById.remove(id));
			inputGates[counter++] = inputGate;
		}

		registerInputMetrics(config.isNetworkDetailedMetrics(), config.isCreditBased(), networkInputGroup, inputGates);
		return Arrays.asList(inputGates);
	}
}
 
Example 2
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 3
Source File: NettyShuffleEnvironment.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public List<SingleInputGate> createInputGates(
		ShuffleIOOwnerContext ownerContext,
		PartitionProducerStateProvider partitionProducerStateProvider,
		List<InputGateDeploymentDescriptor> inputGateDeploymentDescriptors) {
	synchronized (lock) {
		Preconditions.checkState(!isClosed, "The NettyShuffleEnvironment has already been shut down.");

		MetricGroup networkInputGroup = ownerContext.getInputGroup();
		@SuppressWarnings("deprecation")
		InputChannelMetrics inputChannelMetrics = new InputChannelMetrics(networkInputGroup, ownerContext.getParentGroup());

		SingleInputGate[] inputGates = new SingleInputGate[inputGateDeploymentDescriptors.size()];
		for (int gateIndex = 0; gateIndex < inputGates.length; gateIndex++) {
			final InputGateDeploymentDescriptor igdd = inputGateDeploymentDescriptors.get(gateIndex);
			SingleInputGate inputGate = singleInputGateFactory.create(
				ownerContext.getOwnerName(),
				gateIndex,
				igdd,
				partitionProducerStateProvider,
				inputChannelMetrics);
			InputGateID id = new InputGateID(igdd.getConsumedResultId(), ownerContext.getExecutionAttemptID());
			inputGatesById.put(id, inputGate);
			inputGate.getCloseFuture().thenRun(() -> inputGatesById.remove(id));
			inputGates[gateIndex] = inputGate;
		}

		registerInputMetrics(config.isNetworkDetailedMetrics(), networkInputGroup, inputGates);
		return Arrays.asList(inputGates);
	}
}
 
Example 4
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;
}