use of org.apache.flink.runtime.rest.messages.JobExceptionsInfoWithHistory in project flink by apache.
the class JobExceptionsHandlerTest method testOnlyRootCause.
@Test
public void testOnlyRootCause() throws HandlerRequestException {
final Throwable rootCause = new RuntimeException("root cause");
final long rootCauseTimestamp = System.currentTimeMillis();
final ExecutionGraphInfo executionGraphInfo = createExecutionGraphInfo(fromGlobalFailure(rootCause, rootCauseTimestamp));
final HandlerRequest<EmptyRequestBody> request = createRequest(executionGraphInfo.getJobId(), 10);
final JobExceptionsInfoWithHistory response = testInstance.handleRequest(request, executionGraphInfo);
assertThat(response.getRootException(), is(ExceptionUtils.stringifyException(rootCause)));
assertThat(response.getRootTimestamp(), is(rootCauseTimestamp));
assertFalse(response.isTruncated());
assertThat(response.getAllExceptions(), empty());
assertThat(response.getExceptionHistory().getEntries(), contains(historyContainsGlobalFailure(rootCause, rootCauseTimestamp)));
}
use of org.apache.flink.runtime.rest.messages.JobExceptionsInfoWithHistory 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.rest.messages.JobExceptionsInfoWithHistory 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.rest.messages.JobExceptionsInfoWithHistory 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.rest.messages.JobExceptionsInfoWithHistory 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()))));
}
Aggregations