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));
}
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);
}
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()));
}
}
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)));
}
}
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();
}
}
Aggregations