Search in sources :

Example 1 with IntermediateResult

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;
}
Also used : IntermediateResult(org.apache.flink.runtime.executiongraph.IntermediateResult) IntermediateResultPartition(org.apache.flink.runtime.executiongraph.IntermediateResultPartition) IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)

Example 2 with IntermediateResult

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);
}
Also used : IntermediateResult(org.apache.flink.runtime.executiongraph.IntermediateResult) TaskManagerLocation(org.apache.flink.runtime.taskmanager.TaskManagerLocation) ResultPartitionID(org.apache.flink.runtime.io.network.partition.ResultPartitionID) IntermediateDataSetID(org.apache.flink.runtime.jobgraph.IntermediateDataSetID)

Example 3 with IntermediateResult

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.");
        }
    }
}
Also used : IntermediateResult(org.apache.flink.runtime.executiongraph.IntermediateResult) Execution(org.apache.flink.runtime.executiongraph.Execution) PartitionProducerDisposedException(org.apache.flink.runtime.jobmanager.PartitionProducerDisposedException) RpcMethod(org.apache.flink.runtime.rpc.RpcMethod)

Aggregations

IntermediateResult (org.apache.flink.runtime.executiongraph.IntermediateResult)3 Execution (org.apache.flink.runtime.executiongraph.Execution)1 IntermediateResultPartition (org.apache.flink.runtime.executiongraph.IntermediateResultPartition)1 ResultPartitionID (org.apache.flink.runtime.io.network.partition.ResultPartitionID)1 IntermediateDataSetID (org.apache.flink.runtime.jobgraph.IntermediateDataSetID)1 IntermediateResultPartitionID (org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)1 PartitionProducerDisposedException (org.apache.flink.runtime.jobmanager.PartitionProducerDisposedException)1 RpcMethod (org.apache.flink.runtime.rpc.RpcMethod)1 TaskManagerLocation (org.apache.flink.runtime.taskmanager.TaskManagerLocation)1