XComp commented on a change in pull request #15049:
URL: https://github.com/apache/flink/pull/15049#discussion_r592238675



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/job/JobExceptionsHandler.java
##########
@@ -132,7 +143,61 @@ private static JobExceptionsInfo createJobExceptionsInfo(
             }
         }
 
+        final ErrorInfo rootCause = executionGraph.getFailureInfo();
+        return new JobExceptionsInfoWithHistory(
+                rootCause.getException().getOriginalErrorClassName(),
+                rootCause.getExceptionAsString(),
+                rootCause.getTimestamp(),
+                taskExceptionList,
+                truncated,
+                createJobExceptionHistory(
+                        executionGraphInfo.getExceptionHistory(), 
exceptionToReportMaxSize));
+    }
+
+    static JobExceptionsInfoWithHistory.JobExceptionHistory 
createJobExceptionHistory(
+            BoundedFIFOQueue<ExceptionHistoryEntry> historyEntries, int limit) 
{
+        // we need to reverse the history to have a stable result when doing 
paging on it
+        final List<ExceptionHistoryEntry> reversedHistoryEntries = new 
ArrayList<>();
+        Iterables.addAll(reversedHistoryEntries, historyEntries);
+        Collections.reverse(reversedHistoryEntries);
+
+        List<JobExceptionsInfo> exceptionHistoryEntries =
+                reversedHistoryEntries.stream()
+                        .limit(limit)
+                        .map(JobExceptionsHandler::createJobExceptionInfo)
+                        .collect(Collectors.toList());
+
+        return new JobExceptionsInfoWithHistory.JobExceptionHistory(
+                exceptionHistoryEntries,
+                historyEntries.getElementCount(),

Review comment:
       I had a chat with @NicoK about it. He agrees that (on the UI side) it's 
not necessarily useful to have the over all count of exceptions presented as it 
might grow for long-running jobs. Instead, we could introduce a 
`max-size-reached` flag to indicate that exception history's maximum size was 
reached. The UI would then just print `...` and have a refer to the 
corresponding configuration option and the logs for further analysis.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to