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



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/SchedulerBase.java
##########
@@ -635,6 +641,33 @@ public void cancel() {
         return 
executionGraph.getTerminationFuture().thenApply(FunctionUtils.nullFn());
     }
 
+    protected void archiveGlobalFailure(Throwable failure) {
+        taskFailureHistory.add(
+                new ErrorInfo(failure, 
executionGraph.getStatusTimestamp(JobStatus.FAILED)));
+        log.debug("Archive global failure.", failure);
+    }
+
+    protected void archiveFromFailureHandlingResult(FailureHandlingResult 
failureHandlingResult) {
+        Optional<Execution> executionOptional =
+                failureHandlingResult
+                        .getExecutionVertexIdOfFailedTask()
+                        .map(this::getExecutionVertex)
+                        .map(ExecutionVertex::getCurrentExecutionAttempt);
+
+        executionOptional.ifPresent(
+                execution ->
+                        execution
+                                .getFailureInfo()
+                                .ifPresent(
+                                        failureInfo -> {
+                                            
taskFailureHistory.add(failureInfo);
+                                            log.debug(
+                                                    "Archive local failure 
causing attempt {} to fail: {}",
+                                                    execution.getAttemptId(),
+                                                    
failureInfo.getExceptionAsString());
+                                        }));

Review comment:
       But looking into that again, I realize that there is, indeed, the 
`failureInfo` in `ExecutionGraph` that is set during 
[handleTaskFailure](https://github.com/XComp/flink/blob/8e732bfb2bddc38ec7422f482dcda4be3d296408/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/DefaultScheduler.java#L218)
 and 
[handleGlobalFailure](https://github.com/XComp/flink/blob/8e732bfb2bddc38ec7422f482dcda4be3d296408/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/DefaultScheduler.java#L236).
 This is used to forward the current root cause of the `ExecutionGraph` to the 
Web UI. I could have used that. But the drawback is that it's using 
`System.currentMillis`.
   
   Instead, I'm gonna work on removing the `ExecutionGraph.failureInfo` (and 
related methods) as part of FLINK-21190. It becomes redundant after we enable 
to exception history since it's just the exception history's last entry.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to