Search in sources :

Example 41 with Execution

use of org.apache.flink.runtime.executiongraph.Execution in project flink by apache.

the class StateAssignmentOperation method assignTaskStateToExecutionJobVertices.

private void assignTaskStateToExecutionJobVertices(TaskStateAssignment assignment) {
    ExecutionJobVertex executionJobVertex = assignment.executionJobVertex;
    List<OperatorIDPair> operatorIDs = executionJobVertex.getOperatorIDs();
    final int newParallelism = executionJobVertex.getParallelism();
    /*
         *  An executionJobVertex's all state handles needed to restore are something like a matrix
         *
         * 		parallelism0 parallelism1 parallelism2 parallelism3
         * op0   sh(0,0)     sh(0,1)       sh(0,2)	    sh(0,3)
         * op1   sh(1,0)	 sh(1,1)	   sh(1,2)	    sh(1,3)
         * op2   sh(2,0)	 sh(2,1)	   sh(2,2)		sh(2,3)
         * op3   sh(3,0)	 sh(3,1)	   sh(3,2)		sh(3,3)
         *
         */
    for (int subTaskIndex = 0; subTaskIndex < newParallelism; subTaskIndex++) {
        Execution currentExecutionAttempt = executionJobVertex.getTaskVertices()[subTaskIndex].getCurrentExecutionAttempt();
        if (assignment.isFullyFinished) {
            assignFinishedStateToTask(currentExecutionAttempt);
        } else {
            assignNonFinishedStateToTask(assignment, operatorIDs, subTaskIndex, currentExecutionAttempt);
        }
    }
}
Also used : Execution(org.apache.flink.runtime.executiongraph.Execution) ExecutionJobVertex(org.apache.flink.runtime.executiongraph.ExecutionJobVertex) OperatorIDPair(org.apache.flink.runtime.OperatorIDPair)

Example 42 with Execution

use of org.apache.flink.runtime.executiongraph.Execution in project flink by apache.

the class AdaptiveBatchSchedulerTest method transitionExecutionsState.

/**
 * Transit the state of all executions in the Job Vertex.
 */
public static void transitionExecutionsState(final SchedulerBase scheduler, final ExecutionState state, final JobVertex jobVertex) {
    final ExecutionGraph executionGraph = scheduler.getExecutionGraph();
    List<Execution> executions = Arrays.asList(executionGraph.getJobVertex(jobVertex.getID()).getTaskVertices()).stream().map(ExecutionVertex::getCurrentExecutionAttempt).collect(Collectors.toList());
    transitionExecutionsState(scheduler, state, executions);
}
Also used : Execution(org.apache.flink.runtime.executiongraph.Execution) ExecutionGraph(org.apache.flink.runtime.executiongraph.ExecutionGraph) DefaultExecutionGraph(org.apache.flink.runtime.executiongraph.DefaultExecutionGraph)

Example 43 with Execution

use of org.apache.flink.runtime.executiongraph.Execution in project flink by apache.

the class DeployingDownstreamTasksInBatchJobBenchmark method deployDownstreamTasks.

public void deployDownstreamTasks() throws Exception {
    for (ExecutionVertex ev : vertices) {
        Execution execution = ev.getCurrentExecutionAttempt();
        execution.transitionState(ExecutionState.SCHEDULED);
        execution.deploy();
    }
}
Also used : Execution(org.apache.flink.runtime.executiongraph.Execution) ExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionVertex)

Example 44 with Execution

use of org.apache.flink.runtime.executiongraph.Execution in project flink by apache.

the class SchedulerBenchmarkUtils method deployAllTasks.

public static void deployAllTasks(ExecutionGraph executionGraph, TestingLogicalSlotBuilder slotBuilder) throws JobException, ExecutionException, InterruptedException {
    for (ExecutionVertex vertex : executionGraph.getAllExecutionVertices()) {
        LogicalSlot slot = slotBuilder.createTestingLogicalSlot();
        Execution execution = vertex.getCurrentExecutionAttempt();
        execution.transitionState(ExecutionState.SCHEDULED);
        execution.registerProducedPartitions(slot.getTaskManagerLocation(), true).get();
        assignResourceAndDeploy(vertex, slot);
    }
}
Also used : Execution(org.apache.flink.runtime.executiongraph.Execution) ExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionVertex) LogicalSlot(org.apache.flink.runtime.jobmaster.LogicalSlot)

Example 45 with Execution

use of org.apache.flink.runtime.executiongraph.Execution in project flink by apache.

the class SchedulerBenchmarkUtils method deployTasks.

public static void deployTasks(ExecutionGraph executionGraph, JobVertexID jobVertexID, TestingLogicalSlotBuilder slotBuilder, boolean sendScheduleOrUpdateConsumersMessage) throws JobException, ExecutionException, InterruptedException {
    for (ExecutionVertex vertex : executionGraph.getJobVertex(jobVertexID).getTaskVertices()) {
        LogicalSlot slot = slotBuilder.createTestingLogicalSlot();
        Execution execution = vertex.getCurrentExecutionAttempt();
        execution.transitionState(ExecutionState.SCHEDULED);
        execution.registerProducedPartitions(slot.getTaskManagerLocation(), sendScheduleOrUpdateConsumersMessage).get();
        assignResourceAndDeploy(vertex, slot);
    }
}
Also used : Execution(org.apache.flink.runtime.executiongraph.Execution) ExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionVertex) LogicalSlot(org.apache.flink.runtime.jobmaster.LogicalSlot)

Aggregations

Execution (org.apache.flink.runtime.executiongraph.Execution)45 ExecutionVertex (org.apache.flink.runtime.executiongraph.ExecutionVertex)26 ExecutionJobVertex (org.apache.flink.runtime.executiongraph.ExecutionJobVertex)11 ExecutionAttemptID (org.apache.flink.runtime.executiongraph.ExecutionAttemptID)8 JobID (org.apache.flink.api.common.JobID)7 JobVertexID (org.apache.flink.runtime.jobgraph.JobVertexID)7 Test (org.junit.Test)7 AcknowledgeCheckpoint (org.apache.flink.runtime.messages.checkpoint.AcknowledgeCheckpoint)6 ArrayList (java.util.ArrayList)5 IOException (java.io.IOException)4 ExecutionGraph (org.apache.flink.runtime.executiongraph.ExecutionGraph)4 DeclineCheckpoint (org.apache.flink.runtime.messages.checkpoint.DeclineCheckpoint)4 HashMap (java.util.HashMap)3 CompletableFuture (java.util.concurrent.CompletableFuture)3 TimeoutException (java.util.concurrent.TimeoutException)3 Time (org.apache.flink.api.common.time.Time)3 PartitionProducerDisposedException (org.apache.flink.runtime.jobmanager.PartitionProducerDisposedException)3 LogicalSlot (org.apache.flink.runtime.jobmaster.LogicalSlot)3 StackTraceSampleResponse (org.apache.flink.runtime.messages.StackTraceSampleResponse)3 Collection (java.util.Collection)2