use of org.apache.flink.runtime.scheduler.DefaultScheduler in project flink by apache.
the class OperatorCoordinatorSchedulerTest method testTakeCheckpoint.
// ------------------------------------------------------------------------
// tests for checkpointing
// ------------------------------------------------------------------------
@Test
public void testTakeCheckpoint() throws Exception {
final byte[] checkpointData = new byte[656];
new Random().nextBytes(checkpointData);
final DefaultScheduler scheduler = createSchedulerAndDeployTasks();
final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
final CompletableFuture<CompletedCheckpoint> checkpointFuture = triggerCheckpoint(scheduler);
coordinator.getLastTriggeredCheckpoint().complete(checkpointData);
acknowledgeCurrentCheckpoint(scheduler);
final OperatorState state = checkpointFuture.get().getOperatorStates().get(testOperatorId);
assertArrayEquals(checkpointData, getStateHandleContents(state.getCoordinatorState()));
}
use of org.apache.flink.runtime.scheduler.DefaultScheduler in project flink by apache.
the class OperatorCoordinatorSchedulerTest method taskTaskManagerFailuresAreReportedBack.
@Test
public void taskTaskManagerFailuresAreReportedBack() throws Exception {
final DefaultScheduler scheduler = createSchedulerAndDeployTasks(new FailingTaskExecutorOperatorEventGateway());
final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
final OperatorCoordinator.SubtaskGateway gateway = coordinator.getSubtaskGateway(0);
final CompletableFuture<?> result = gateway.sendEvent(new TestOperatorEvent());
// process event sending
executor.triggerAll();
assertThat(result, futureFailedWith(TestException.class));
}
use of org.apache.flink.runtime.scheduler.DefaultScheduler in project flink by apache.
the class OperatorCoordinatorSchedulerTest method taskGatewayNotSetBeforeTasksRunning.
@Test
public void taskGatewayNotSetBeforeTasksRunning() throws Exception {
final DefaultScheduler scheduler = createAndStartScheduler();
final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
final OperatorCoordinator.SubtaskGateway gateway = coordinator.getSubtaskGateway(0);
assertNull(gateway);
}
use of org.apache.flink.runtime.scheduler.DefaultScheduler in project flink by apache.
the class OperatorCoordinatorSchedulerTest method createSchedulerWithRestoredSavepoint.
private DefaultScheduler createSchedulerWithRestoredSavepoint(byte[] coordinatorState) throws Exception {
final byte[] savepointMetadata = serializeAsCheckpointMetadata(testOperatorId, coordinatorState);
final String savepointPointer = "testingSavepointPointer";
final TestingCheckpointStorageAccessCoordinatorView storage = new TestingCheckpointStorageAccessCoordinatorView();
storage.registerSavepoint(savepointPointer, savepointMetadata);
final Consumer<JobGraph> savepointConfigurer = (jobGraph) -> {
SchedulerTestingUtils.enableCheckpointing(jobGraph, new ModernStateBackend(), storage.asCheckpointStorage());
jobGraph.setSavepointRestoreSettings(SavepointRestoreSettings.forPath(savepointPointer));
};
final DefaultScheduler scheduler = setupTestJobAndScheduler(new TestingOperatorCoordinator.Provider(testOperatorId), null, savepointConfigurer, false);
scheduler.startScheduling();
return scheduler;
}
use of org.apache.flink.runtime.scheduler.DefaultScheduler in project flink by apache.
the class OperatorCoordinatorSchedulerTest method deployingTaskCancellationNotifiesCoordinator.
// THESE TESTS BELOW SHOULD LEGITIMATELY WORK, BUT THE SCHEDULER ITSELF SEEMS TO NOT HANDLE
// THIS SITUATION AT THE MOMENT
// WE KEEP THESE TESTS HERE TO ENABLE THEM ONCE THE SCHEDULER'S CONTRACT SUPPORTS THEM
@Ignore
@Test
public void deployingTaskCancellationNotifiesCoordinator() throws Exception {
final DefaultScheduler scheduler = createAndStartScheduler();
final TestingOperatorCoordinator coordinator = getCoordinator(scheduler);
cancelTask(scheduler, 1);
assertEquals(1, coordinator.getFailedTasks().size());
assertThat(coordinator.getFailedTasks(), contains(1));
assertThat(coordinator.getFailedTasks(), not(contains(0)));
}
Aggregations