Search in sources :

Example 11 with DefaultScheduler

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

the class OperatorCoordinatorSchedulerTest method deployingTaskFailureNotifiesCoordinator.

@Test
public void deployingTaskFailureNotifiesCoordinator() throws Exception {
    final DefaultScheduler scheduler = createAndStartScheduler();
    final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
    failTask(scheduler, 1);
    assertEquals(1, coordinator.getFailedTasks().size());
    assertThat(coordinator.getFailedTasks(), contains(1));
    assertThat(coordinator.getFailedTasks(), not(contains(0)));
}
Also used : DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler) Test(org.junit.Test)

Example 12 with DefaultScheduler

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

the class OperatorCoordinatorSchedulerTest method testGlobalFailureResetsToCheckpoint.

@Test
public void testGlobalFailureResetsToCheckpoint() throws Exception {
    final DefaultScheduler scheduler = createSchedulerAndDeployTasks();
    final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
    final byte[] coordinatorState = new byte[] { 7, 11, 3, 5 };
    takeCompleteCheckpoint(scheduler, coordinator, coordinatorState);
    failGlobalAndRestart(scheduler, new TestException());
    assertArrayEquals("coordinator should have a restored checkpoint", coordinatorState, coordinator.getLastRestoredCheckpointState());
}
Also used : DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler) Test(org.junit.Test)

Example 13 with DefaultScheduler

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

the class OperatorCoordinatorSchedulerTest method createSchedulerAndDeployTasks.

private DefaultScheduler createSchedulerAndDeployTasks(TaskExecutorOperatorEventGateway gateway) throws Exception {
    final DefaultScheduler scheduler = setupTestJobAndScheduler(new TestingOperatorCoordinator.Provider(testOperatorId), gateway, null, false);
    scheduleAllTasksToRunning(scheduler);
    return scheduler;
}
Also used : DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler)

Example 14 with DefaultScheduler

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

the class OperatorCoordinatorSchedulerTest method testSnapshotAsyncFailureFailsCheckpoint.

@Test
public void testSnapshotAsyncFailureFailsCheckpoint() throws Exception {
    final DefaultScheduler scheduler = createSchedulerAndDeployTasks();
    final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
    final CompletableFuture<?> checkpointFuture = triggerCheckpoint(scheduler);
    final CompletableFuture<?> coordinatorStateFuture = coordinator.getLastTriggeredCheckpoint();
    coordinatorStateFuture.completeExceptionally(new TestException());
    waitForCompletionToPropagate(checkpointFuture);
    assertThat(checkpointFuture, futureWillCompleteWithTestException());
}
Also used : DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler) Test(org.junit.Test)

Example 15 with DefaultScheduler

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

the class OperatorCoordinatorSchedulerTest method taskGatewayAvailableWhenTasksRunning.

@Test
public void taskGatewayAvailableWhenTasksRunning() throws Exception {
    final DefaultScheduler scheduler = createSchedulerAndDeployTasks();
    final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
    final OperatorCoordinator.SubtaskGateway gateway = coordinator.getSubtaskGateway(0);
    assertNotNull(gateway);
}
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