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());
}
}
}
Aggregations