Search in sources :

Example 31 with DefaultScheduler

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

the class OperatorCoordinatorSchedulerTest method testGlobalFailureBeforeCheckpointResetsToEmptyState.

@Test
public void testGlobalFailureBeforeCheckpointResetsToEmptyState() throws Exception {
    final DefaultScheduler scheduler = createSchedulerAndDeployTasks();
    final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
    failGlobalAndRestart(scheduler, new TestException());
    assertSame("coordinator should have null restored state", TestingOperatorCoordinator.NULL_RESTORE_VALUE, coordinator.getLastRestoredCheckpointState());
    assertEquals(OperatorCoordinator.NO_CHECKPOINT, coordinator.getLastRestoredCheckpointId());
}
Also used : DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler) Test(org.junit.Test)

Example 32 with DefaultScheduler

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

the class OperatorCoordinatorSchedulerTest method testDeliveringClientRequestToNonExistingCoordinator.

@Test
public void testDeliveringClientRequestToNonExistingCoordinator() throws Exception {
    final OperatorCoordinator.Provider provider = new TestingOperatorCoordinator.Provider(testOperatorId);
    final DefaultScheduler scheduler = createScheduler(provider);
    final String payload = "testing payload";
    final TestingCoordinationRequestHandler.Request<String> request = new TestingCoordinationRequestHandler.Request<>(payload);
    CommonTestUtils.assertThrows("does not exist", FlinkException.class, () -> scheduler.deliverCoordinationRequestToCoordinator(new OperatorID(), request));
}
Also used : OperatorID(org.apache.flink.runtime.jobgraph.OperatorID) DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler) TtlTimeProvider(org.apache.flink.runtime.state.ttl.TtlTimeProvider) Test(org.junit.Test)

Example 33 with DefaultScheduler

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

the class OperatorCoordinatorSchedulerTest method testDeliveringClientRequestToNonRequestHandler.

@Test
public void testDeliveringClientRequestToNonRequestHandler() throws Exception {
    final OperatorCoordinator.Provider provider = new TestingOperatorCoordinator.Provider(testOperatorId);
    final DefaultScheduler scheduler = createScheduler(provider);
    final String payload = "testing payload";
    final TestingCoordinationRequestHandler.Request<String> request = new TestingCoordinationRequestHandler.Request<>(payload);
    CommonTestUtils.assertThrows("cannot handle client event", FlinkException.class, () -> scheduler.deliverCoordinationRequestToCoordinator(testOperatorId, request));
}
Also used : DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler) TtlTimeProvider(org.apache.flink.runtime.state.ttl.TtlTimeProvider) Test(org.junit.Test)

Example 34 with DefaultScheduler

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

the class OperatorCoordinatorSchedulerTest method testSavepointRestoresCoordinator.

@Test
public void testSavepointRestoresCoordinator() throws Exception {
    final byte[] testCoordinatorState = new byte[123];
    new Random().nextBytes(testCoordinatorState);
    final DefaultScheduler scheduler = createSchedulerWithRestoredSavepoint(testCoordinatorState);
    final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
    final byte[] restoredState = coordinator.getLastRestoredCheckpointState();
    assertArrayEquals(testCoordinatorState, restoredState);
}
Also used : Random(java.util.Random) DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler) Test(org.junit.Test)

Example 35 with DefaultScheduler

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

the class OperatorCoordinatorSchedulerTest method createSchedulerAndDeployTasks.

private DefaultScheduler createSchedulerAndDeployTasks(OperatorCoordinator.Provider provider) throws Exception {
    final DefaultScheduler scheduler = setupTestJobAndScheduler(provider);
    scheduleAllTasksToRunning(scheduler);
    return scheduler;
}
Also used : DefaultScheduler(org.apache.flink.runtime.scheduler.DefaultScheduler)

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