Search in sources :

Example 6 with DefaultScheduler

use of org.apache.flink.runtime.scheduler.DefaultScheduler in project flink by apache.

the class OperatorCoordinatorSchedulerTest method createAndStartScheduler.

private DefaultScheduler createAndStartScheduler() throws Exception {
    final DefaultScheduler scheduler = setupTestJobAndScheduler(new TestingOperatorCoordinator.Provider(testOperatorId));
    scheduler.startScheduling();
    executor.triggerAll();
    // guard test assumptions: this brings tasks into DEPLOYING state
    assertEquals(ExecutionState.DEPLOYING, SchedulerTestingUtils.getExecutionState(scheduler, testVertexId, 0));
    return scheduler;
}
Also used : DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler)

Example 7 with DefaultScheduler

use of org.apache.flink.runtime.scheduler.DefaultScheduler in project flink by apache.

the class OperatorCoordinatorSchedulerTest method testSnapshotSyncFailureFailsCheckpoint.

@Test
public void testSnapshotSyncFailureFailsCheckpoint() throws Exception {
    final OperatorCoordinator.Provider failingCoordinatorProvider = new TestingOperatorCoordinator.Provider(testOperatorId, CoordinatorThatFailsCheckpointing::new);
    final DefaultScheduler scheduler = createSchedulerAndDeployTasks(failingCoordinatorProvider);
    final CompletableFuture<?> checkpointFuture = triggerCheckpoint(scheduler);
    assertThat(checkpointFuture, futureWillCompleteWithTestException());
}
Also used : DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler) TtlTimeProvider(org.apache.flink.runtime.state.ttl.TtlTimeProvider) Test(org.junit.Test)

Example 8 with DefaultScheduler

use of org.apache.flink.runtime.scheduler.DefaultScheduler in project flink by apache.

the class OperatorCoordinatorSchedulerTest method taskRepeatedFailureNotifyCoordinator.

@Test
public void taskRepeatedFailureNotifyCoordinator() throws Exception {
    final DefaultScheduler scheduler = createSchedulerAndDeployTasks();
    final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
    failAndRestartTask(scheduler, 0);
    failAndRestartTask(scheduler, 0);
    assertEquals(2, coordinator.getFailedTasks().size());
    assertThat(coordinator.getFailedTasks(), contains(0, 0));
}
Also used : DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler) Test(org.junit.Test)

Example 9 with DefaultScheduler

use of org.apache.flink.runtime.scheduler.DefaultScheduler in project flink by apache.

the class OperatorCoordinatorSchedulerTest method testGlobalFailoverDoesNotNotifyLocalRestore.

@Test
public void testGlobalFailoverDoesNotNotifyLocalRestore() throws Exception {
    final DefaultScheduler scheduler = createSchedulerAndDeployTasks();
    final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
    takeCompleteCheckpoint(scheduler, coordinator, new byte[0]);
    failGlobalAndRestart(scheduler, new TestException());
    assertThat(coordinator.getRestoredTasks(), empty());
}
Also used : DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler) Test(org.junit.Test)

Example 10 with DefaultScheduler

use of org.apache.flink.runtime.scheduler.DefaultScheduler in project flink by apache.

the class OperatorCoordinatorSchedulerTest method testBatchLocalFailoverDoesNotResetToCheckpoint.

@Test
public void testBatchLocalFailoverDoesNotResetToCheckpoint() throws Exception {
    final DefaultScheduler scheduler = createSchedulerWithoutCheckpointingAndDeployTasks();
    final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
    failAndRestartTask(scheduler, 0);
    assertNull("coordinator should not have a restored checkpoint", coordinator.getLastRestoredCheckpointState());
}
Also used : DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler) Test(org.junit.Test)

Aggregations

DefaultScheduler (org.apache.flink.runtime.scheduler.DefaultScheduler)45 Test (org.junit.Test)34 JobVertex (org.apache.flink.runtime.jobgraph.JobVertex)9 TtlTimeProvider (org.apache.flink.runtime.state.ttl.TtlTimeProvider)9 JobID (org.apache.flink.api.common.JobID)7 IOException (java.io.IOException)5 Random (java.util.Random)5 ComponentMainThreadExecutor (org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor)5 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)5 OperatorID (org.apache.flink.runtime.jobgraph.OperatorID)5 Ignore (org.junit.Ignore)5 OperatorIDPair (org.apache.flink.runtime.OperatorIDPair)4 CompletedCheckpoint (org.apache.flink.runtime.checkpoint.CompletedCheckpoint)4 OperatorState (org.apache.flink.runtime.checkpoint.OperatorState)4 ComponentMainThreadExecutorServiceAdapter (org.apache.flink.runtime.concurrent.ComponentMainThreadExecutorServiceAdapter)4 ExecutionJobVertex (org.apache.flink.runtime.executiongraph.ExecutionJobVertex)4 RestartAllFailoverStrategy (org.apache.flink.runtime.executiongraph.failover.flip1.RestartAllFailoverStrategy)4 SchedulerTestingUtils (org.apache.flink.runtime.scheduler.SchedulerTestingUtils)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 Duration (java.time.Duration)3