Search in sources :

Example 6 with JobExceptionsInfoWithHistory

use of org.apache.flink.runtime.rest.messages.JobExceptionsInfoWithHistory in project flink by apache.

the class JobExceptionsHandler method createJobExceptionsInfo.

private static JobExceptionsInfoWithHistory createJobExceptionsInfo(ExecutionGraphInfo executionGraphInfo, int exceptionToReportMaxSize) {
    final ArchivedExecutionGraph executionGraph = executionGraphInfo.getArchivedExecutionGraph();
    if (executionGraph.getFailureInfo() == null) {
        return new JobExceptionsInfoWithHistory();
    }
    List<JobExceptionsInfo.ExecutionExceptionInfo> taskExceptionList = new ArrayList<>();
    boolean truncated = false;
    for (AccessExecutionVertex task : executionGraph.getAllExecutionVertices()) {
        Optional<ErrorInfo> failure = task.getFailureInfo();
        if (failure.isPresent()) {
            if (taskExceptionList.size() >= exceptionToReportMaxSize) {
                truncated = true;
                break;
            }
            TaskManagerLocation location = task.getCurrentAssignedResourceLocation();
            String locationString = toString(location);
            long timestamp = task.getStateTimestamp(ExecutionState.FAILED);
            taskExceptionList.add(new JobExceptionsInfo.ExecutionExceptionInfo(failure.get().getExceptionAsString(), task.getTaskNameWithSubtaskIndex(), locationString, timestamp == 0 ? -1 : timestamp));
        }
    }
    final ErrorInfo rootCause = executionGraph.getFailureInfo();
    return new JobExceptionsInfoWithHistory(rootCause.getExceptionAsString(), rootCause.getTimestamp(), taskExceptionList, truncated, createJobExceptionHistory(executionGraphInfo.getExceptionHistory(), exceptionToReportMaxSize));
}
Also used : TaskManagerLocation(org.apache.flink.runtime.taskmanager.TaskManagerLocation) ErrorInfo(org.apache.flink.runtime.executiongraph.ErrorInfo) ArrayList(java.util.ArrayList) ArchivedExecutionGraph(org.apache.flink.runtime.executiongraph.ArchivedExecutionGraph) JobExceptionsInfo(org.apache.flink.runtime.rest.messages.JobExceptionsInfo) JobExceptionsInfoWithHistory(org.apache.flink.runtime.rest.messages.JobExceptionsInfoWithHistory) AccessExecutionVertex(org.apache.flink.runtime.executiongraph.AccessExecutionVertex)

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