use of org.apache.flink.runtime.io.network.partition.consumer.InputGateID in project flink by apache.
the class NettyShuffleEnvironment method createInputGates.
@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();
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, gateIndex, igdd, partitionProducerStateProvider);
InputGateID id = new InputGateID(igdd.getConsumedResultId(), ownerContext.getExecutionAttemptID());
inputGatesById.put(id, inputGate);
inputGate.getCloseFuture().thenRun(() -> inputGatesById.remove(id));
inputGates[gateIndex] = inputGate;
}
if (config.getDebloatConfiguration().isEnabled()) {
registerDebloatingTaskMetrics(inputGates, ownerContext.getParentGroup());
}
registerInputMetrics(config.isNetworkDetailedMetrics(), networkInputGroup, inputGates);
return Arrays.asList(inputGates);
}
}
use of org.apache.flink.runtime.io.network.partition.consumer.InputGateID in project flink by apache.
the class NettyShuffleEnvironment method updatePartitionInfo.
@Override
public boolean updatePartitionInfo(ExecutionAttemptID consumerID, PartitionInfo partitionInfo) throws IOException, InterruptedException {
IntermediateDataSetID intermediateResultPartitionID = partitionInfo.getIntermediateDataSetID();
InputGateID id = new InputGateID(intermediateResultPartitionID, consumerID);
SingleInputGate inputGate = inputGatesById.get(id);
if (inputGate == null) {
return false;
}
ShuffleDescriptor shuffleDescriptor = partitionInfo.getShuffleDescriptor();
checkArgument(shuffleDescriptor instanceof NettyShuffleDescriptor, "Tried to update unknown channel with unknown ShuffleDescriptor %s.", shuffleDescriptor.getClass().getName());
inputGate.updateInputChannel(taskExecutorResourceId, (NettyShuffleDescriptor) shuffleDescriptor);
return true;
}
Aggregations