Search in sources :

Example 1 with DefaultVertexAttemptNumberStore

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;
}
Also used : DefaultVertexAttemptNumberStore(org.apache.flink.runtime.executiongraph.DefaultVertexAttemptNumberStore) ExecutionGraph(org.apache.flink.runtime.executiongraph.ExecutionGraph) ArchivedExecutionGraph(org.apache.flink.runtime.executiongraph.ArchivedExecutionGraph)

Example 2 with DefaultVertexAttemptNumberStore

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"));
    }
}
Also used : DefaultVertexAttemptNumberStore(org.apache.flink.runtime.executiongraph.DefaultVertexAttemptNumberStore) JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) StandaloneCompletedCheckpointStore(org.apache.flink.runtime.checkpoint.StandaloneCompletedCheckpointStore) CheckpointsCleaner(org.apache.flink.runtime.checkpoint.CheckpointsCleaner) IOException(java.io.IOException) StandaloneCheckpointIDCounter(org.apache.flink.runtime.checkpoint.StandaloneCheckpointIDCounter) Test(org.junit.Test)

Example 3 with DefaultVertexAttemptNumberStore

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));
}
Also used : DefaultVertexAttemptNumberStore(org.apache.flink.runtime.executiongraph.DefaultVertexAttemptNumberStore) CompletedCheckpoint(org.apache.flink.runtime.checkpoint.CompletedCheckpoint) JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) StandaloneCompletedCheckpointStore(org.apache.flink.runtime.checkpoint.StandaloneCompletedCheckpointStore) CheckpointsCleaner(org.apache.flink.runtime.checkpoint.CheckpointsCleaner) StandaloneCheckpointIDCounter(org.apache.flink.runtime.checkpoint.StandaloneCheckpointIDCounter) Test(org.junit.Test)

Aggregations

DefaultVertexAttemptNumberStore (org.apache.flink.runtime.executiongraph.DefaultVertexAttemptNumberStore)3 CheckpointsCleaner (org.apache.flink.runtime.checkpoint.CheckpointsCleaner)2 StandaloneCheckpointIDCounter (org.apache.flink.runtime.checkpoint.StandaloneCheckpointIDCounter)2 StandaloneCompletedCheckpointStore (org.apache.flink.runtime.checkpoint.StandaloneCompletedCheckpointStore)2 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 CompletedCheckpoint (org.apache.flink.runtime.checkpoint.CompletedCheckpoint)1 ArchivedExecutionGraph (org.apache.flink.runtime.executiongraph.ArchivedExecutionGraph)1 ExecutionGraph (org.apache.flink.runtime.executiongraph.ExecutionGraph)1