use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class JobExceptionsHandlerTest method testNoExceptions.
@Test
public void testNoExceptions() throws HandlerRequestException {
final ExecutionGraphInfo executionGraphInfo = new ExecutionGraphInfo(new ArchivedExecutionGraphBuilder().build());
final HandlerRequest<EmptyRequestBody> request = createRequest(executionGraphInfo.getJobId(), 10);
final JobExceptionsInfoWithHistory response = testInstance.handleRequest(request, executionGraphInfo);
assertThat(response.getRootException(), is(nullValue()));
assertThat(response.getRootTimestamp(), is(nullValue()));
assertFalse(response.isTruncated());
assertThat(response.getAllExceptions(), empty());
assertThat(response.getExceptionHistory().getEntries(), empty());
}
use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class JobExceptionsHandlerTest method createExecutionGraphInfo.
// -------- exception history related utility methods for creating the input data --------
private static ExecutionGraphInfo createExecutionGraphInfo(RootExceptionHistoryEntry... historyEntries) {
final ArchivedExecutionGraphBuilder executionGraphBuilder = new ArchivedExecutionGraphBuilder();
final List<RootExceptionHistoryEntry> historyEntryCollection = new ArrayList<>();
for (int i = 0; i < historyEntries.length; i++) {
if (i == 0) {
// first entry is root cause
executionGraphBuilder.setFailureCause(new ErrorInfo(historyEntries[i].getException(), historyEntries[i].getTimestamp()));
}
historyEntryCollection.add(historyEntries[i]);
}
// we have to reverse it to simulate how the Scheduler collects it
Collections.reverse(historyEntryCollection);
return new ExecutionGraphInfo(executionGraphBuilder.build(), historyEntryCollection);
}
use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo in project flink by apache.
the class JobExceptionsHandlerTest method testWithExceptionHistory.
@Test
public void testWithExceptionHistory() 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(), 10);
final JobExceptionsInfoWithHistory response = testInstance.handleRequest(request, executionGraphInfo);
assertThat(response.getExceptionHistory().getEntries(), contains(historyContainsGlobalFailure(rootCause.getException(), rootCause.getTimestamp()), historyContainsJobExceptionInfo(otherFailure.getException(), otherFailure.getTimestamp(), otherFailure.getFailingTaskName(), JobExceptionsHandler.toString(otherFailure.getTaskManagerLocation()))));
assertFalse(response.getExceptionHistory().isTruncated());
}
use of org.apache.flink.runtime.scheduler.ExecutionGraphInfo 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.scheduler.ExecutionGraphInfo 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());
}
Aggregations