Search in sources :

Example 6 with FailureHandlingResult

use of org.apache.flink.runtime.executiongraph.failover.flip1.FailureHandlingResult in project flink-mirror by flink-ci.

the class FailureHandlingResultSnapshotTest method testLocalFailureHandlingResultSnapshotCreation.

@Test
public void testLocalFailureHandlingResultSnapshotCreation() {
    final ExecutionVertex rootCauseExecutionVertex = extractExecutionVertex(0);
    final Throwable rootCause = new RuntimeException("Expected exception: root cause");
    final ExecutionVertex otherFailedExecutionVertex = extractExecutionVertex(1);
    final Throwable otherFailure = new IllegalStateException("Expected exception: other failure");
    final long rootCauseTimestamp = triggerFailure(rootCauseExecutionVertex, rootCause);
    triggerFailure(otherFailedExecutionVertex, otherFailure);
    final FailureHandlingResult failureHandlingResult = FailureHandlingResult.restartable(rootCauseExecutionVertex.getID(), rootCause, rootCauseTimestamp, StreamSupport.stream(executionGraph.getAllExecutionVertices().spliterator(), false).map(ExecutionVertex::getID).collect(Collectors.toSet()), 0L, false);
    final FailureHandlingResultSnapshot testInstance = FailureHandlingResultSnapshot.create(failureHandlingResult, this::getLatestExecution);
    assertThat(testInstance.getRootCause(), is(rootCause));
    assertThat(testInstance.getTimestamp(), is(rootCauseTimestamp));
    assertThat(testInstance.getRootCauseExecution().isPresent(), is(true));
    assertThat(testInstance.getRootCauseExecution().get(), is(rootCauseExecutionVertex.getCurrentExecutionAttempt()));
    assertThat(testInstance.getConcurrentlyFailedExecution(), IsIterableContainingInOrder.contains(otherFailedExecutionVertex.getCurrentExecutionAttempt()));
}
Also used : FailureHandlingResult(org.apache.flink.runtime.executiongraph.failover.flip1.FailureHandlingResult) SerializedThrowable(org.apache.flink.util.SerializedThrowable) ExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionVertex) Test(org.junit.Test)

Example 7 with FailureHandlingResult

use of org.apache.flink.runtime.executiongraph.failover.flip1.FailureHandlingResult in project flink by splunk.

the class DefaultScheduler method handleTaskFailure.

private void handleTaskFailure(final ExecutionVertexID executionVertexId, @Nullable final Throwable error) {
    final long timestamp = System.currentTimeMillis();
    setGlobalFailureCause(error, timestamp);
    notifyCoordinatorsAboutTaskFailure(executionVertexId, error);
    final FailureHandlingResult failureHandlingResult = executionFailureHandler.getFailureHandlingResult(executionVertexId, error, timestamp);
    maybeRestartTasks(failureHandlingResult);
}
Also used : FailureHandlingResult(org.apache.flink.runtime.executiongraph.failover.flip1.FailureHandlingResult)

Example 8 with FailureHandlingResult

use of org.apache.flink.runtime.executiongraph.failover.flip1.FailureHandlingResult in project flink by splunk.

the class DefaultScheduler method handleGlobalFailure.

@Override
public void handleGlobalFailure(final Throwable error) {
    final long timestamp = System.currentTimeMillis();
    setGlobalFailureCause(error, timestamp);
    log.info("Trying to recover from a global failure.", error);
    final FailureHandlingResult failureHandlingResult = executionFailureHandler.getGlobalFailureHandlingResult(error, timestamp);
    maybeRestartTasks(failureHandlingResult);
}
Also used : FailureHandlingResult(org.apache.flink.runtime.executiongraph.failover.flip1.FailureHandlingResult)

Example 9 with FailureHandlingResult

use of org.apache.flink.runtime.executiongraph.failover.flip1.FailureHandlingResult in project flink by apache.

the class DefaultScheduler method handleTaskFailure.

private void handleTaskFailure(final ExecutionVertexID executionVertexId, @Nullable final Throwable error) {
    final long timestamp = System.currentTimeMillis();
    setGlobalFailureCause(error, timestamp);
    notifyCoordinatorsAboutTaskFailure(executionVertexId, error);
    final FailureHandlingResult failureHandlingResult = executionFailureHandler.getFailureHandlingResult(executionVertexId, error, timestamp);
    maybeRestartTasks(failureHandlingResult);
}
Also used : FailureHandlingResult(org.apache.flink.runtime.executiongraph.failover.flip1.FailureHandlingResult)

Example 10 with FailureHandlingResult

use of org.apache.flink.runtime.executiongraph.failover.flip1.FailureHandlingResult in project flink by apache.

the class FailureHandlingResultSnapshotTest method testRootCauseVertexNotFailed.

@Test(expected = IllegalArgumentException.class)
public void testRootCauseVertexNotFailed() {
    final ExecutionVertex rootCauseExecutionVertex = extractExecutionVertex(0);
    final FailureHandlingResult failureHandlingResult = FailureHandlingResult.restartable(rootCauseExecutionVertex.getID(), new RuntimeException("Expected exception: root cause"), System.currentTimeMillis(), StreamSupport.stream(executionGraph.getAllExecutionVertices().spliterator(), false).map(ExecutionVertex::getID).collect(Collectors.toSet()), 0L, false);
    FailureHandlingResultSnapshot.create(failureHandlingResult, this::getLatestExecution);
}
Also used : FailureHandlingResult(org.apache.flink.runtime.executiongraph.failover.flip1.FailureHandlingResult) ExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionVertex) Test(org.junit.Test)

Aggregations

FailureHandlingResult (org.apache.flink.runtime.executiongraph.failover.flip1.FailureHandlingResult)21 ExecutionVertex (org.apache.flink.runtime.executiongraph.ExecutionVertex)15 Test (org.junit.Test)12 SerializedThrowable (org.apache.flink.util.SerializedThrowable)9 FlinkException (org.apache.flink.util.FlinkException)6 Collections (java.util.Collections)3 Objects (java.util.Objects)3 Optional (java.util.Optional)3 Set (java.util.Set)3 Function (java.util.function.Function)3 Collectors (java.util.stream.Collectors)3 Nullable (javax.annotation.Nullable)3 VisibleForTesting (org.apache.flink.annotation.VisibleForTesting)3 ErrorInfo (org.apache.flink.runtime.executiongraph.ErrorInfo)3 Execution (org.apache.flink.runtime.executiongraph.Execution)3 ExecutionVertexID (org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID)3 Preconditions (org.apache.flink.util.Preconditions)3