use of org.apache.flink.runtime.scheduler.exceptionhistory.RootExceptionHistoryEntry in project flink by apache.
the class JobExceptionsHandlerTest method testWithExceptionHistoryWithTruncationThroughParameter.
@Test
public void testWithExceptionHistoryWithTruncationThroughParameter() throws HandlerRequestException {
final RootExceptionHistoryEntry rootCause = fromGlobalFailure(new RuntimeException("exception #0"), System.currentTimeMillis());
final RootExceptionHistoryEntry otherFailure = new RootExceptionHistoryEntry(new RuntimeException("exception #1"), System.currentTimeMillis(), "task name", new LocalTaskManagerLocation(), Collections.emptySet());
final ExecutionGraphInfo executionGraphInfo = createExecutionGraphInfo(rootCause, otherFailure);
final HandlerRequest<EmptyRequestBody> request = createRequest(executionGraphInfo.getJobId(), 1);
final JobExceptionsInfoWithHistory response = testInstance.handleRequest(request, executionGraphInfo);
assertThat(response.getExceptionHistory().getEntries(), contains(historyContainsGlobalFailure(rootCause.getException(), rootCause.getTimestamp())));
assertThat(response.getExceptionHistory().getEntries(), iterableWithSize(1));
assertTrue(response.getExceptionHistory().isTruncated());
}
use of org.apache.flink.runtime.scheduler.exceptionhistory.RootExceptionHistoryEntry in project flink by apache.
the class JobExceptionsHandlerTest method testWithLocalExceptionHistoryEntryNotHavingATaskManagerInformationAvailable.
@Test
public void testWithLocalExceptionHistoryEntryNotHavingATaskManagerInformationAvailable() throws HandlerRequestException {
final RootExceptionHistoryEntry failure = new RootExceptionHistoryEntry(new RuntimeException("exception #1"), System.currentTimeMillis(), "task name", null, Collections.emptySet());
final ExecutionGraphInfo executionGraphInfo = createExecutionGraphInfo(failure);
final HandlerRequest<EmptyRequestBody> request = createRequest(executionGraphInfo.getJobId(), 10);
final JobExceptionsInfoWithHistory response = testInstance.handleRequest(request, executionGraphInfo);
assertThat(response.getExceptionHistory().getEntries(), contains(historyContainsJobExceptionInfo(failure.getException(), failure.getTimestamp(), failure.getFailingTaskName(), JobExceptionsHandler.toString(failure.getTaskManagerLocation()))));
}
use of org.apache.flink.runtime.scheduler.exceptionhistory.RootExceptionHistoryEntry in project flink by apache.
the class SchedulerBase method archiveFromFailureHandlingResult.
protected final void archiveFromFailureHandlingResult(FailureHandlingResultSnapshot failureHandlingResult) {
if (failureHandlingResult.getRootCauseExecution().isPresent()) {
final Execution rootCauseExecution = failureHandlingResult.getRootCauseExecution().get();
final RootExceptionHistoryEntry rootEntry = RootExceptionHistoryEntry.fromFailureHandlingResultSnapshot(failureHandlingResult);
exceptionHistory.add(rootEntry);
log.debug("Archive local failure causing attempt {} to fail: {}", rootCauseExecution.getAttemptId(), rootEntry.getExceptionAsString());
} else {
archiveGlobalFailure(failureHandlingResult.getRootCause(), failureHandlingResult.getTimestamp(), failureHandlingResult.getConcurrentlyFailedExecution());
}
}
use of org.apache.flink.runtime.scheduler.exceptionhistory.RootExceptionHistoryEntry in project flink by apache.
the class DefaultSchedulerTest method testExceptionHistoryWithGlobalFailOver.
@Test
public void testExceptionHistoryWithGlobalFailOver() {
final JobGraph jobGraph = singleNonParallelJobVertexJobGraph();
final DefaultScheduler scheduler = createSchedulerAndStartScheduling(jobGraph);
final ExecutionAttemptID attemptId = Iterables.getOnlyElement(scheduler.requestJob().getArchivedExecutionGraph().getAllExecutionVertices()).getCurrentExecutionAttempt().getAttemptId();
final Exception expectedException = new Exception("Expected exception");
scheduler.handleGlobalFailure(expectedException);
// we have to cancel the task and trigger the restart to have the exception history
// populated
scheduler.updateTaskExecutionState(new TaskExecutionState(attemptId, ExecutionState.CANCELED, expectedException));
taskRestartExecutor.triggerScheduledTasks();
final Iterable<RootExceptionHistoryEntry> actualExceptionHistory = scheduler.getExceptionHistory();
assertThat(actualExceptionHistory, IsIterableWithSize.iterableWithSize(1));
final RootExceptionHistoryEntry failure = actualExceptionHistory.iterator().next();
assertThat(failure, ExceptionHistoryEntryMatcher.matchesGlobalFailure(expectedException, scheduler.getExecutionGraph().getFailureInfo().getTimestamp()));
assertThat(failure.getConcurrentExceptions(), IsEmptyIterable.emptyIterable());
}
use of org.apache.flink.runtime.scheduler.exceptionhistory.RootExceptionHistoryEntry 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())));
}
Aggregations