Search in sources :

Example 26 with ExecutionGraphInfo

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());
}
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 27 with ExecutionGraphInfo

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);
}
Also used : RootExceptionHistoryEntry(org.apache.flink.runtime.scheduler.exceptionhistory.RootExceptionHistoryEntry) ExecutionGraphInfo(org.apache.flink.runtime.scheduler.ExecutionGraphInfo) ErrorInfo(org.apache.flink.runtime.executiongraph.ErrorInfo) ArrayList(java.util.ArrayList) ArchivedExecutionGraphBuilder(org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder)

Example 28 with ExecutionGraphInfo

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());
}
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 29 with ExecutionGraphInfo

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);
}
Also used : ArchivedExecutionJobVertex(org.apache.flink.runtime.executiongraph.ArchivedExecutionJobVertex) RootExceptionHistoryEntry(org.apache.flink.runtime.scheduler.exceptionhistory.RootExceptionHistoryEntry) HashMap(java.util.HashMap) ExecutionGraphInfo(org.apache.flink.runtime.scheduler.ExecutionGraphInfo) JobVertexID(org.apache.flink.runtime.jobgraph.JobVertexID) ErrorInfo(org.apache.flink.runtime.executiongraph.ErrorInfo) LocalTaskManagerLocation(org.apache.flink.runtime.taskmanager.LocalTaskManagerLocation) SerializedThrowable(org.apache.flink.util.SerializedThrowable) ArchivedExecutionGraphBuilder(org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder)

Example 30 with ExecutionGraphInfo

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());
}
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)

Aggregations

ExecutionGraphInfo (org.apache.flink.runtime.scheduler.ExecutionGraphInfo)45 Test (org.junit.Test)33 ArchivedExecutionGraphBuilder (org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder)23 Time (org.apache.flink.api.common.time.Time)12 CompletableFuture (java.util.concurrent.CompletableFuture)11 JobID (org.apache.flink.api.common.JobID)11 JobStatus (org.apache.flink.api.common.JobStatus)9 FlinkException (org.apache.flink.util.FlinkException)8 File (java.io.File)7 TestingJobManagerRunner (org.apache.flink.runtime.jobmaster.TestingJobManagerRunner)7 ArrayList (java.util.ArrayList)6 ArchivedExecutionGraph (org.apache.flink.runtime.executiongraph.ArchivedExecutionGraph)6 FlinkJobNotFoundException (org.apache.flink.runtime.messages.FlinkJobNotFoundException)6 EmptyRequestBody (org.apache.flink.runtime.rest.messages.EmptyRequestBody)6 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)5 JobManagerRunner (org.apache.flink.runtime.jobmaster.JobManagerRunner)5 Acknowledge (org.apache.flink.runtime.messages.Acknowledge)5 JobExceptionsInfoWithHistory (org.apache.flink.runtime.rest.messages.JobExceptionsInfoWithHistory)5 RootExceptionHistoryEntry (org.apache.flink.runtime.scheduler.exceptionhistory.RootExceptionHistoryEntry)5 ExceptionUtils (org.apache.flink.util.ExceptionUtils)5