use of org.apache.flink.runtime.executiongraph.DefaultVertexAttemptNumberStore in project flink by apache.
the class SchedulerBase method createAndRestoreExecutionGraph.
private ExecutionGraph createAndRestoreExecutionGraph(CompletedCheckpointStore completedCheckpointStore, CheckpointsCleaner checkpointsCleaner, CheckpointIDCounter checkpointIdCounter, long initializationTimestamp, ComponentMainThreadExecutor mainThreadExecutor, JobStatusListener jobStatusListener, VertexParallelismStore vertexParallelismStore) throws Exception {
final ExecutionGraph newExecutionGraph = executionGraphFactory.createAndRestoreExecutionGraph(jobGraph, completedCheckpointStore, checkpointsCleaner, checkpointIdCounter, TaskDeploymentDescriptorFactory.PartitionLocationConstraint.fromJobType(jobGraph.getJobType()), initializationTimestamp, new DefaultVertexAttemptNumberStore(), vertexParallelismStore, deploymentStateTimeMetrics, log);
newExecutionGraph.setInternalTaskFailuresListener(new UpdateSchedulerNgOnInternalFailuresListener(this));
newExecutionGraph.registerJobStatusListener(jobStatusListener);
newExecutionGraph.start(mainThreadExecutor);
return newExecutionGraph;
}
use of org.apache.flink.runtime.executiongraph.DefaultVertexAttemptNumberStore in project flink by apache.
the class DefaultExecutionGraphFactoryTest method testRestoringModifiedJobFromSavepointFails.
@Test
public void testRestoringModifiedJobFromSavepointFails() throws Exception {
final JobGraph jobGraphWithNewOperator = createJobGraphWithSavepoint(false, 42L);
final ExecutionGraphFactory executionGraphFactory = createExecutionGraphFactory();
try {
executionGraphFactory.createAndRestoreExecutionGraph(jobGraphWithNewOperator, new StandaloneCompletedCheckpointStore(1), new CheckpointsCleaner(), new StandaloneCheckpointIDCounter(), TaskDeploymentDescriptorFactory.PartitionLocationConstraint.CAN_BE_UNKNOWN, 0L, new DefaultVertexAttemptNumberStore(), SchedulerBase.computeVertexParallelismStore(jobGraphWithNewOperator), (execution, previousState, newState) -> {
}, log);
fail("Expected ExecutionGraph creation to fail because of non restored state.");
} catch (Exception e) {
assertThat(e, FlinkMatchers.containsMessage("Failed to rollback to checkpoint/savepoint"));
}
}
use of org.apache.flink.runtime.executiongraph.DefaultVertexAttemptNumberStore in project flink by apache.
the class DefaultExecutionGraphFactoryTest method testRestoringModifiedJobFromSavepointWithAllowNonRestoredStateSucceeds.
@Test
public void testRestoringModifiedJobFromSavepointWithAllowNonRestoredStateSucceeds() throws Exception {
// create savepoint data
final long savepointId = 42L;
final JobGraph jobGraphWithNewOperator = createJobGraphWithSavepoint(true, savepointId);
final ExecutionGraphFactory executionGraphFactory = createExecutionGraphFactory();
final StandaloneCompletedCheckpointStore completedCheckpointStore = new StandaloneCompletedCheckpointStore(1);
executionGraphFactory.createAndRestoreExecutionGraph(jobGraphWithNewOperator, completedCheckpointStore, new CheckpointsCleaner(), new StandaloneCheckpointIDCounter(), TaskDeploymentDescriptorFactory.PartitionLocationConstraint.CAN_BE_UNKNOWN, 0L, new DefaultVertexAttemptNumberStore(), SchedulerBase.computeVertexParallelismStore(jobGraphWithNewOperator), (execution, previousState, newState) -> {
}, log);
final CompletedCheckpoint savepoint = completedCheckpointStore.getLatestCheckpoint();
MatcherAssert.assertThat(savepoint, notNullValue());
MatcherAssert.assertThat(savepoint.getCheckpointID(), Matchers.is(savepointId));
}
Aggregations