Search in sources :

Example 6 with ErrorInfo

use of org.apache.flink.runtime.executiongraph.ErrorInfo in project flink by apache.

the class DefaultSchedulerTest method failureInfoIsSetAfterTaskFailure.

@Test
public void failureInfoIsSetAfterTaskFailure() {
    final JobGraph jobGraph = singleNonParallelJobVertexJobGraph();
    final DefaultScheduler scheduler = createSchedulerAndStartScheduling(jobGraph);
    final ArchivedExecutionVertex onlyExecutionVertex = Iterables.getOnlyElement(scheduler.requestJob().getArchivedExecutionGraph().getAllExecutionVertices());
    final ExecutionAttemptID attemptId = onlyExecutionVertex.getCurrentExecutionAttempt().getAttemptId();
    final String exceptionMessage = "expected exception";
    scheduler.updateTaskExecutionState(new TaskExecutionState(attemptId, ExecutionState.FAILED, new RuntimeException(exceptionMessage)));
    final ErrorInfo failureInfo = scheduler.requestJob().getArchivedExecutionGraph().getFailureInfo();
    assertThat(failureInfo, is(notNullValue()));
    assertThat(failureInfo.getExceptionAsString(), containsString(exceptionMessage));
}
Also used : JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) ExecutionAttemptID(org.apache.flink.runtime.executiongraph.ExecutionAttemptID) ArchivedExecutionVertex(org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex) ErrorInfo(org.apache.flink.runtime.executiongraph.ErrorInfo) Matchers.containsString(org.hamcrest.Matchers.containsString) TaskExecutionState(org.apache.flink.runtime.taskmanager.TaskExecutionState) AdaptiveSchedulerTest(org.apache.flink.runtime.scheduler.adaptive.AdaptiveSchedulerTest) Test(org.junit.Test)

Example 7 with ErrorInfo

use of org.apache.flink.runtime.executiongraph.ErrorInfo in project flink by apache.

the class DefaultJobMasterServiceProcessTest method testInitializationFailureSetsFailureInfoProperly.

@Test
public void testInitializationFailureSetsFailureInfoProperly() throws ExecutionException, InterruptedException {
    final CompletableFuture<JobMasterService> jobMasterServiceFuture = new CompletableFuture<>();
    DefaultJobMasterServiceProcess serviceProcess = createTestInstance(jobMasterServiceFuture);
    final RuntimeException originalCause = new RuntimeException("Expected RuntimeException");
    long beforeFailureTimestamp = System.currentTimeMillis();
    jobMasterServiceFuture.completeExceptionally(originalCause);
    long afterFailureTimestamp = System.currentTimeMillis();
    final JobManagerRunnerResult result = serviceProcess.getResultFuture().get();
    final ErrorInfo executionGraphFailure = result.getExecutionGraphInfo().getArchivedExecutionGraph().getFailureInfo();
    assertThat(executionGraphFailure).isNotNull();
    assertInitializationException(executionGraphFailure.getException(), originalCause, executionGraphFailure.getTimestamp(), beforeFailureTimestamp, afterFailureTimestamp);
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) ErrorInfo(org.apache.flink.runtime.executiongraph.ErrorInfo) Test(org.junit.jupiter.api.Test)

Example 8 with ErrorInfo

use of org.apache.flink.runtime.executiongraph.ErrorInfo in project flink by apache.

the class JobResultTest method testCancelledJobThrowsJobCancellationException.

@Test
public void testCancelledJobThrowsJobCancellationException() throws Exception {
    final FlinkException cause = new FlinkException("Test exception");
    final JobResult jobResult = JobResult.createFrom(new ArchivedExecutionGraphBuilder().setJobID(new JobID()).setState(JobStatus.CANCELED).setFailureCause(new ErrorInfo(cause, 42L)).build());
    try {
        jobResult.toJobExecutionResult(getClass().getClassLoader());
        fail("Job should fail with an JobCancellationException.");
    } catch (JobCancellationException expected) {
        // the failure cause in the execution graph should not be the cause of the canceled job
        // result
        assertThat(expected.getCause(), is(nullValue()));
    }
}
Also used : JobCancellationException(org.apache.flink.runtime.client.JobCancellationException) ErrorInfo(org.apache.flink.runtime.executiongraph.ErrorInfo) ArchivedExecutionGraphBuilder(org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder) FlinkException(org.apache.flink.util.FlinkException) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Example 9 with ErrorInfo

use of org.apache.flink.runtime.executiongraph.ErrorInfo in project flink by apache.

the class JobResultTest method testFailedJobThrowsJobExecutionException.

@Test
public void testFailedJobThrowsJobExecutionException() throws Exception {
    final FlinkException cause = new FlinkException("Test exception");
    final JobResult jobResult = JobResult.createFrom(new ArchivedExecutionGraphBuilder().setJobID(new JobID()).setState(JobStatus.FAILED).setFailureCause(new ErrorInfo(cause, 42L)).build());
    try {
        jobResult.toJobExecutionResult(getClass().getClassLoader());
        fail("Job should fail with JobExecutionException.");
    } catch (JobExecutionException expected) {
        assertThat(expected.getCause(), is(equalTo(cause)));
    }
}
Also used : JobExecutionException(org.apache.flink.runtime.client.JobExecutionException) ErrorInfo(org.apache.flink.runtime.executiongraph.ErrorInfo) ArchivedExecutionGraphBuilder(org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder) FlinkException(org.apache.flink.util.FlinkException) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Example 10 with ErrorInfo

use of org.apache.flink.runtime.executiongraph.ErrorInfo in project flink by apache.

the class CancelingTest method testTaskFailuresAreIgnored.

@Test
public void testTaskFailuresAreIgnored() throws Exception {
    try (MockStateWithExecutionGraphContext ctx = new MockStateWithExecutionGraphContext()) {
        StateTrackingMockExecutionGraph meg = new StateTrackingMockExecutionGraph();
        Canceling canceling = createCancelingState(ctx, meg);
        // register execution at EG
        Exception exception = new RuntimeException();
        TestingAccessExecution execution = TestingAccessExecution.newBuilder().withExecutionState(ExecutionState.FAILED).withErrorInfo(new ErrorInfo(exception, System.currentTimeMillis())).build();
        meg.registerExecution(execution);
        TaskExecutionStateTransition update = ExecutingTest.createFailingStateTransition(execution.getAttemptId(), exception);
        canceling.updateTaskExecutionState(update);
        ctx.assertNoStateTransition();
    }
}
Also used : TestingAccessExecution(org.apache.flink.runtime.scheduler.exceptionhistory.TestingAccessExecution) TaskExecutionStateTransition(org.apache.flink.runtime.executiongraph.TaskExecutionStateTransition) ErrorInfo(org.apache.flink.runtime.executiongraph.ErrorInfo) Test(org.junit.Test)

Aggregations

ErrorInfo (org.apache.flink.runtime.executiongraph.ErrorInfo)27 Test (org.junit.Test)17 JobID (org.apache.flink.api.common.JobID)9 TaskExecutionStateTransition (org.apache.flink.runtime.executiongraph.TaskExecutionStateTransition)8 TestingAccessExecution (org.apache.flink.runtime.scheduler.exceptionhistory.TestingAccessExecution)8 ArchivedExecutionGraphBuilder (org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder)7 FlinkException (org.apache.flink.util.FlinkException)7 JobStatus (org.apache.flink.api.common.JobStatus)5 CompletableFuture (java.util.concurrent.CompletableFuture)4 ArchivedExecutionGraph (org.apache.flink.runtime.executiongraph.ArchivedExecutionGraph)4 ExecutionGraphInfo (org.apache.flink.runtime.scheduler.ExecutionGraphInfo)4 RootExceptionHistoryEntry (org.apache.flink.runtime.scheduler.exceptionhistory.RootExceptionHistoryEntry)4 Duration (java.time.Duration)3 Deadline (org.apache.flink.api.common.time.Deadline)3 JobExecutionException (org.apache.flink.runtime.client.JobExecutionException)3 ArchivedExecutionVertex (org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex)3 LocalTaskManagerLocation (org.apache.flink.runtime.taskmanager.LocalTaskManagerLocation)3 File (java.io.File)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2