Search in sources :

Example 21 with FailureHandlingResult

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

the class FailureHandlingResultSnapshotTest method testGlobalFailureHandlingResultSnapshotCreation.

@Test
public void testGlobalFailureHandlingResultSnapshotCreation() {
    final Throwable rootCause = new FlinkException("Expected exception: root cause");
    final long timestamp = System.currentTimeMillis();
    final ExecutionVertex failedExecutionVertex0 = extractExecutionVertex(0);
    final Throwable failure0 = new RuntimeException("Expected exception: failure #0");
    final ExecutionVertex failedExecutionVertex1 = extractExecutionVertex(1);
    final Throwable failure1 = new IllegalStateException("Expected exception: failure #1");
    triggerFailure(failedExecutionVertex0, failure0);
    triggerFailure(failedExecutionVertex1, failure1);
    final FailureHandlingResult failureHandlingResult = FailureHandlingResult.restartable(null, rootCause, timestamp, StreamSupport.stream(executionGraph.getAllExecutionVertices().spliterator(), false).map(ExecutionVertex::getID).collect(Collectors.toSet()), 0L, true);
    final FailureHandlingResultSnapshot testInstance = FailureHandlingResultSnapshot.create(failureHandlingResult, this::getLatestExecution);
    assertThat(testInstance.getRootCause(), is(rootCause));
    assertThat(testInstance.getTimestamp(), is(timestamp));
    assertThat(testInstance.getRootCauseExecution().isPresent(), is(false));
    assertThat(testInstance.getConcurrentlyFailedExecution(), IsIterableContainingInAnyOrder.containsInAnyOrder(failedExecutionVertex0.getCurrentExecutionAttempt(), failedExecutionVertex1.getCurrentExecutionAttempt()));
}
Also used : FailureHandlingResult(org.apache.flink.runtime.executiongraph.failover.flip1.FailureHandlingResult) SerializedThrowable(org.apache.flink.util.SerializedThrowable) FlinkException(org.apache.flink.util.FlinkException) 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