use of org.apache.flink.runtime.executiongraph.IntermediateResult in project flink by apache.
the class InputChannelDeploymentDescriptorTest method mockPartition.
private static IntermediateResultPartition mockPartition(ExecutionVertex producer) {
IntermediateResultPartition partition = mock(IntermediateResultPartition.class);
when(partition.isConsumable()).thenReturn(true);
IntermediateResult result = mock(IntermediateResult.class);
when(result.getConnectionIndex()).thenReturn(0);
when(partition.getIntermediateResult()).thenReturn(result);
when(partition.getPartitionId()).thenReturn(new IntermediateResultPartitionID());
when(partition.getProducer()).thenReturn(producer);
return partition;
}
use of org.apache.flink.runtime.executiongraph.IntermediateResult in project flink by apache.
the class PartialInputChannelDeploymentDescriptor method fromEdge.
// ------------------------------------------------------------------------
/**
* Creates a partial input channel for the given partition and producing task.
*/
public static PartialInputChannelDeploymentDescriptor fromEdge(IntermediateResultPartition partition, Execution producer) {
final ResultPartitionID partitionId = new ResultPartitionID(partition.getPartitionId(), producer.getAttemptId());
final IntermediateResult result = partition.getIntermediateResult();
final IntermediateDataSetID resultId = result.getId();
final TaskManagerLocation partitionConnectionInfo = producer.getAssignedResourceLocation();
final int partitionConnectionIndex = result.getConnectionIndex();
return new PartialInputChannelDeploymentDescriptor(resultId, partitionId, partitionConnectionInfo, partitionConnectionIndex);
}
use of org.apache.flink.runtime.executiongraph.IntermediateResult in project flink by apache.
the class JobMaster method requestPartitionState.
@RpcMethod
public ExecutionState requestPartitionState(final UUID leaderSessionID, final IntermediateDataSetID intermediateResultId, final ResultPartitionID resultPartitionId) throws Exception {
validateLeaderSessionId(leaderSessionID);
final Execution execution = executionGraph.getRegisteredExecutions().get(resultPartitionId.getProducerId());
if (execution != null) {
return execution.getState();
} else {
final IntermediateResult intermediateResult = executionGraph.getAllIntermediateResults().get(intermediateResultId);
if (intermediateResult != null) {
// Try to find the producing execution
Execution producerExecution = intermediateResult.getPartitionById(resultPartitionId.getPartitionId()).getProducer().getCurrentExecutionAttempt();
if (producerExecution.getAttemptId() == resultPartitionId.getProducerId()) {
return producerExecution.getState();
} else {
throw new PartitionProducerDisposedException(resultPartitionId);
}
} else {
throw new IllegalArgumentException("Intermediate data set with ID " + intermediateResultId + " not found.");
}
}
}
Aggregations