Search in sources :

Example 1 with CheckpointExecutionGraphBuilder

use of org.apache.flink.runtime.checkpoint.CheckpointCoordinatorTestingUtils.CheckpointExecutionGraphBuilder in project flink by apache.

the class DefaultCheckpointPlanCalculatorTest method runWithNotRunningTask.

private void runWithNotRunningTask(boolean isRunningVertexSource, boolean isNotRunningVertexSource) throws Exception {
    for (ExecutionState notRunningState : complementOf(EnumSet.of(ExecutionState.RUNNING))) {
        JobVertexID runningVertex = new JobVertexID();
        JobVertexID notRunningVertex = new JobVertexID();
        ExecutionGraph graph = new CheckpointExecutionGraphBuilder().addJobVertex(runningVertex, isRunningVertexSource).addJobVertex(notRunningVertex, isNotRunningVertexSource).setTransitToRunning(false).build();
        // The first vertex is always RUNNING.
        transitVertexToState(graph, runningVertex, ExecutionState.RUNNING);
        // The second vertex is everything except RUNNING.
        transitVertexToState(graph, notRunningVertex, notRunningState);
        DefaultCheckpointPlanCalculator checkpointPlanCalculator = createCheckpointPlanCalculator(graph);
        try {
            checkpointPlanCalculator.calculateCheckpointPlan().get();
            fail("The computation should fail since some tasks to trigger are in " + notRunningState + " state");
        } catch (ExecutionException e) {
            Throwable cause = e.getCause();
            assertThat(cause, instanceOf(CheckpointException.class));
            assertEquals(CheckpointFailureReason.NOT_ALL_REQUIRED_TASKS_RUNNING, ((CheckpointException) cause).getCheckpointFailureReason());
        }
    }
}
Also used : ExecutionState(org.apache.flink.runtime.execution.ExecutionState) JobVertexID(org.apache.flink.runtime.jobgraph.JobVertexID) ExecutionGraph(org.apache.flink.runtime.executiongraph.ExecutionGraph) ExecutionException(java.util.concurrent.ExecutionException) CheckpointExecutionGraphBuilder(org.apache.flink.runtime.checkpoint.CheckpointCoordinatorTestingUtils.CheckpointExecutionGraphBuilder)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)1 CheckpointExecutionGraphBuilder (org.apache.flink.runtime.checkpoint.CheckpointCoordinatorTestingUtils.CheckpointExecutionGraphBuilder)1 ExecutionState (org.apache.flink.runtime.execution.ExecutionState)1 ExecutionGraph (org.apache.flink.runtime.executiongraph.ExecutionGraph)1 JobVertexID (org.apache.flink.runtime.jobgraph.JobVertexID)1