Search in sources :

Example 1 with JobExceptionsInfoWithHistory

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)));
}
Also used : ExecutionGraphInfo(org.apache.flink.runtime.scheduler.ExecutionGraphInfo) SerializedThrowable(org.apache.flink.util.SerializedThrowable) EmptyRequestBody(org.apache.flink.runtime.rest.messages.EmptyRequestBody) JobExceptionsInfoWithHistory(org.apache.flink.runtime.rest.messages.JobExceptionsInfoWithHistory) Test(org.junit.Test)

Example 2 with JobExceptionsInfoWithHistory

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());
}
Also used : ExecutionGraphInfo(org.apache.flink.runtime.scheduler.ExecutionGraphInfo) ArchivedExecutionGraphBuilder(org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder) EmptyRequestBody(org.apache.flink.runtime.rest.messages.EmptyRequestBody) JobExceptionsInfoWithHistory(org.apache.flink.runtime.rest.messages.JobExceptionsInfoWithHistory) Test(org.junit.Test)

Example 3 with JobExceptionsInfoWithHistory

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());
}
Also used : RootExceptionHistoryEntry(org.apache.flink.runtime.scheduler.exceptionhistory.RootExceptionHistoryEntry) ExecutionGraphInfo(org.apache.flink.runtime.scheduler.ExecutionGraphInfo) LocalTaskManagerLocation(org.apache.flink.runtime.taskmanager.LocalTaskManagerLocation) EmptyRequestBody(org.apache.flink.runtime.rest.messages.EmptyRequestBody) JobExceptionsInfoWithHistory(org.apache.flink.runtime.rest.messages.JobExceptionsInfoWithHistory) Test(org.junit.Test)

Example 4 with JobExceptionsInfoWithHistory

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());
}
Also used : RootExceptionHistoryEntry(org.apache.flink.runtime.scheduler.exceptionhistory.RootExceptionHistoryEntry) ExecutionGraphInfo(org.apache.flink.runtime.scheduler.ExecutionGraphInfo) LocalTaskManagerLocation(org.apache.flink.runtime.taskmanager.LocalTaskManagerLocation) EmptyRequestBody(org.apache.flink.runtime.rest.messages.EmptyRequestBody) JobExceptionsInfoWithHistory(org.apache.flink.runtime.rest.messages.JobExceptionsInfoWithHistory) Test(org.junit.Test)

Example 5 with JobExceptionsInfoWithHistory

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()))));
}
Also used : RootExceptionHistoryEntry(org.apache.flink.runtime.scheduler.exceptionhistory.RootExceptionHistoryEntry) ExecutionGraphInfo(org.apache.flink.runtime.scheduler.ExecutionGraphInfo) EmptyRequestBody(org.apache.flink.runtime.rest.messages.EmptyRequestBody) JobExceptionsInfoWithHistory(org.apache.flink.runtime.rest.messages.JobExceptionsInfoWithHistory) Test(org.junit.Test)

Aggregations

JobExceptionsInfoWithHistory (org.apache.flink.runtime.rest.messages.JobExceptionsInfoWithHistory)6 EmptyRequestBody (org.apache.flink.runtime.rest.messages.EmptyRequestBody)5 ExecutionGraphInfo (org.apache.flink.runtime.scheduler.ExecutionGraphInfo)5 Test (org.junit.Test)5 RootExceptionHistoryEntry (org.apache.flink.runtime.scheduler.exceptionhistory.RootExceptionHistoryEntry)3 LocalTaskManagerLocation (org.apache.flink.runtime.taskmanager.LocalTaskManagerLocation)2 ArrayList (java.util.ArrayList)1 AccessExecutionVertex (org.apache.flink.runtime.executiongraph.AccessExecutionVertex)1 ArchivedExecutionGraph (org.apache.flink.runtime.executiongraph.ArchivedExecutionGraph)1 ErrorInfo (org.apache.flink.runtime.executiongraph.ErrorInfo)1 ArchivedExecutionGraphBuilder (org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder)1 JobExceptionsInfo (org.apache.flink.runtime.rest.messages.JobExceptionsInfo)1 TaskManagerLocation (org.apache.flink.runtime.taskmanager.TaskManagerLocation)1 SerializedThrowable (org.apache.flink.util.SerializedThrowable)1