Search in sources :

Example 41 with DefaultScheduler

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

the class OperatorCoordinatorSchedulerTest method testLocalFailoverResetsTask.

@Test
public void testLocalFailoverResetsTask() throws Exception {
    final DefaultScheduler scheduler = createSchedulerAndDeployTasks();
    final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
    final long checkpointId = takeCompleteCheckpoint(scheduler, coordinator, new byte[0]);
    failAndRestartTask(scheduler, 1);
    assertEquals(1, coordinator.getRestoredTasks().size());
    final TestingOperatorCoordinator.SubtaskAndCheckpoint restoredTask = coordinator.getRestoredTasks().get(0);
    assertEquals(1, restoredTask.subtaskIndex);
    assertEquals(checkpointId, restoredTask.checkpointId);
}
Also used : DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler) Test(org.junit.Test)

Example 42 with DefaultScheduler

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

the class OperatorCoordinatorSchedulerTest method cancellationAsPartOfFailoverNotifiesCoordinator.

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

Example 43 with DefaultScheduler

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

the class OperatorCoordinatorSchedulerTest method testDeliveringClientRequestToRequestHandler.

// ------------------------------------------------------------------------
// tests for REST request delivery
// ------------------------------------------------------------------------
@Test
@SuppressWarnings("unchecked")
public void testDeliveringClientRequestToRequestHandler() throws Exception {
    final OperatorCoordinator.Provider provider = new TestingCoordinationRequestHandler.Provider(testOperatorId);
    final DefaultScheduler scheduler = createScheduler(provider);
    final String payload = "testing payload";
    final TestingCoordinationRequestHandler.Request<String> request = new TestingCoordinationRequestHandler.Request<>(payload);
    final TestingCoordinationRequestHandler.Response<String> response = (TestingCoordinationRequestHandler.Response<String>) scheduler.deliverCoordinationRequestToCoordinator(testOperatorId, request).get();
    assertEquals(payload, response.getPayload());
}
Also used : DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler) TtlTimeProvider(org.apache.flink.runtime.state.ttl.TtlTimeProvider) Test(org.junit.Test)

Example 44 with DefaultScheduler

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

the class OperatorCoordinatorSchedulerTest method testBatchGlobalFailoverDoesNotNotifyLocalRestore.

@Test
public void testBatchGlobalFailoverDoesNotNotifyLocalRestore() throws Exception {
    final DefaultScheduler scheduler = createSchedulerWithoutCheckpointingAndDeployTasks();
    final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
    failGlobalAndRestart(scheduler, new TestException());
    assertThat(coordinator.getRestoredTasks(), empty());
}
Also used : DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler) Test(org.junit.Test)

Example 45 with DefaultScheduler

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

the class OperatorCoordinatorSchedulerTest method testLocalFailoverBeforeCheckpointResetsTask.

@Test
public void testLocalFailoverBeforeCheckpointResetsTask() throws Exception {
    final DefaultScheduler scheduler = createSchedulerAndDeployTasks();
    final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
    failAndRestartTask(scheduler, 1);
    assertEquals(1, coordinator.getRestoredTasks().size());
    final TestingOperatorCoordinator.SubtaskAndCheckpoint restoredTask = coordinator.getRestoredTasks().get(0);
    assertEquals(1, restoredTask.subtaskIndex);
    assertEquals(OperatorCoordinator.NO_CHECKPOINT, restoredTask.checkpointId);
}
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