use of org.apache.flink.runtime.executiongraph.ErrorInfo in project flink by apache.
the class JobExceptionsHandlerTest method createAccessExecutionGraph.
private static ExecutionGraphInfo createAccessExecutionGraph(int numTasks) {
Map<JobVertexID, ArchivedExecutionJobVertex> tasks = new HashMap<>();
for (int i = 0; i < numTasks; i++) {
final JobVertexID jobVertexId = new JobVertexID();
tasks.put(jobVertexId, createArchivedExecutionJobVertex(jobVertexId));
}
final Throwable failureCause = new RuntimeException("root cause");
final long failureTimestamp = System.currentTimeMillis();
final List<RootExceptionHistoryEntry> exceptionHistory = Collections.singletonList(new RootExceptionHistoryEntry(failureCause, failureTimestamp, "test task #1", new LocalTaskManagerLocation(), Collections.emptySet()));
return new ExecutionGraphInfo(new ArchivedExecutionGraphBuilder().setFailureCause(new ErrorInfo(failureCause, failureTimestamp)).setTasks(tasks).build(), exceptionHistory);
}
use of org.apache.flink.runtime.executiongraph.ErrorInfo in project flink by apache.
the class JobExceptionsHandler method createJobExceptionsInfo.
private static JobExceptionsInfoWithHistory createJobExceptionsInfo(ExecutionGraphInfo executionGraphInfo, int exceptionToReportMaxSize) {
final ArchivedExecutionGraph executionGraph = executionGraphInfo.getArchivedExecutionGraph();
if (executionGraph.getFailureInfo() == null) {
return new JobExceptionsInfoWithHistory();
}
List<JobExceptionsInfo.ExecutionExceptionInfo> taskExceptionList = new ArrayList<>();
boolean truncated = false;
for (AccessExecutionVertex task : executionGraph.getAllExecutionVertices()) {
Optional<ErrorInfo> failure = task.getFailureInfo();
if (failure.isPresent()) {
if (taskExceptionList.size() >= exceptionToReportMaxSize) {
truncated = true;
break;
}
TaskManagerLocation location = task.getCurrentAssignedResourceLocation();
String locationString = toString(location);
long timestamp = task.getStateTimestamp(ExecutionState.FAILED);
taskExceptionList.add(new JobExceptionsInfo.ExecutionExceptionInfo(failure.get().getExceptionAsString(), task.getTaskNameWithSubtaskIndex(), locationString, timestamp == 0 ? -1 : timestamp));
}
}
final ErrorInfo rootCause = executionGraph.getFailureInfo();
return new JobExceptionsInfoWithHistory(rootCause.getExceptionAsString(), rootCause.getTimestamp(), taskExceptionList, truncated, createJobExceptionHistory(executionGraphInfo.getExceptionHistory(), exceptionToReportMaxSize));
}
use of org.apache.flink.runtime.executiongraph.ErrorInfo in project flink by apache.
the class DefaultSchedulerTest method testExceptionHistoryWithPreDeployFailure.
@Test
public void testExceptionHistoryWithPreDeployFailure() {
// disable auto-completing slot requests to simulate timeout
executionSlotAllocatorFactory.getTestExecutionSlotAllocator().disableAutoCompletePendingRequests();
final DefaultScheduler scheduler = createSchedulerAndStartScheduling(singleNonParallelJobVertexJobGraph());
executionSlotAllocatorFactory.getTestExecutionSlotAllocator().timeoutPendingRequests();
final ArchivedExecutionVertex taskFailureExecutionVertex = Iterables.getOnlyElement(scheduler.requestJob().getArchivedExecutionGraph().getAllExecutionVertices());
// pending slot request timeout triggers a task failure that needs to be processed
taskRestartExecutor.triggerNonPeriodicScheduledTask();
// sanity check that the TaskManagerLocation of the failed task is indeed null, as expected
assertThat(taskFailureExecutionVertex.getCurrentAssignedResourceLocation(), is(nullValue()));
final ErrorInfo failureInfo = taskFailureExecutionVertex.getFailureInfo().orElseThrow(() -> new AssertionError("A failureInfo should be set."));
final Iterable<RootExceptionHistoryEntry> actualExceptionHistory = scheduler.getExceptionHistory();
assertThat(actualExceptionHistory, IsIterableContainingInOrder.contains(ExceptionHistoryEntryMatcher.matchesFailure(failureInfo.getException(), failureInfo.getTimestamp(), taskFailureExecutionVertex.getTaskNameWithSubtaskIndex(), taskFailureExecutionVertex.getCurrentAssignedResourceLocation())));
}
use of org.apache.flink.runtime.executiongraph.ErrorInfo in project flink by apache.
the class ExceptionHistoryEntryTest method testWithMissingTaskManagerLocation.
@Test
public void testWithMissingTaskManagerLocation() {
final Exception failure = new Exception("Expected failure");
final long timestamp = System.currentTimeMillis();
final String taskName = "task name";
final ExceptionHistoryEntry entry = ExceptionHistoryEntry.create(TestingAccessExecution.newBuilder().withTaskManagerLocation(null).withErrorInfo(new ErrorInfo(failure, timestamp)).build(), taskName);
assertThat(entry.getException().deserializeError(ClassLoader.getSystemClassLoader()), is(failure));
assertThat(entry.getTimestamp(), is(timestamp));
assertThat(entry.getFailingTaskName(), is(taskName));
assertThat(entry.getTaskManagerLocation(), is(nullValue()));
assertThat(entry.isGlobal(), is(false));
}
use of org.apache.flink.runtime.executiongraph.ErrorInfo in project flink by apache.
the class FailingTest method testTaskFailuresAreIgnored.
@Test
public void testTaskFailuresAreIgnored() throws Exception {
try (MockFailingContext ctx = new MockFailingContext()) {
StateTrackingMockExecutionGraph meg = new StateTrackingMockExecutionGraph();
Failing failing = createFailingState(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);
failing.updateTaskExecutionState(update);
ctx.assertNoStateTransition();
}
}
Aggregations