Search in sources :

Example 1 with FailureHandlingResultSnapshot

use of org.apache.flink.runtime.scheduler.exceptionhistory.FailureHandlingResultSnapshot in project flink by apache.

the class DefaultScheduler method restartTasksWithDelay.

private void restartTasksWithDelay(final FailureHandlingResult failureHandlingResult) {
    final Set<ExecutionVertexID> verticesToRestart = failureHandlingResult.getVerticesToRestart();
    final Set<ExecutionVertexVersion> executionVertexVersions = new HashSet<>(executionVertexVersioner.recordVertexModifications(verticesToRestart).values());
    final boolean globalRecovery = failureHandlingResult.isGlobalFailure();
    addVerticesToRestartPending(verticesToRestart);
    final CompletableFuture<?> cancelFuture = cancelTasksAsync(verticesToRestart);
    final FailureHandlingResultSnapshot failureHandlingResultSnapshot = FailureHandlingResultSnapshot.create(failureHandlingResult, id -> this.getExecutionVertex(id).getCurrentExecutionAttempt());
    delayExecutor.schedule(() -> FutureUtils.assertNoException(cancelFuture.thenRunAsync(() -> {
        archiveFromFailureHandlingResult(failureHandlingResultSnapshot);
        restartTasks(executionVertexVersions, globalRecovery);
    }, getMainThreadExecutor())), failureHandlingResult.getRestartDelayMS(), TimeUnit.MILLISECONDS);
}
Also used : ExecutionVertexID(org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID) FailureHandlingResultSnapshot(org.apache.flink.runtime.scheduler.exceptionhistory.FailureHandlingResultSnapshot) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 FailureHandlingResultSnapshot (org.apache.flink.runtime.scheduler.exceptionhistory.FailureHandlingResultSnapshot)1 ExecutionVertexID (org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID)1