autophagy commented on code in PR #19567:
URL: https://github.com/apache/flink/pull/19567#discussion_r858497481


##########
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java:
##########
@@ -652,20 +653,47 @@ private CompletableFuture<CleanupJobState> 
handleJobManagerRunnerResult(
                 && executionType == ExecutionType.RECOVERY) {
             return CompletableFuture.completedFuture(
                     jobManagerRunnerFailed(
-                            
jobManagerRunnerResult.getExecutionGraphInfo().getJobId(),
+                            jobManagerRunnerResult,
                             
jobManagerRunnerResult.getInitializationFailure()));
         }
         return 
jobReachedTerminalState(jobManagerRunnerResult.getExecutionGraphInfo());
     }
 
-    enum CleanupJobState {
-        LOCAL,
-        GLOBAL
+    private static class CleanupJobState {
+
+        private final JobStatus jobStatus;
+        private final boolean globalCleanup;
+
+        public static CleanupJobState localCleanup(JobStatus jobStatus) {
+            return new CleanupJobState(jobStatus, false);
+        }
+
+        public static CleanupJobState globalCleanup(JobStatus jobStatus) {
+            return new CleanupJobState(jobStatus, true);
+        }
+
+        private CleanupJobState(JobStatus jobStatus, boolean globalCleanup) {
+            this.jobStatus = jobStatus;
+            this.globalCleanup = globalCleanup;
+        }
+
+        public boolean isGlobalCleanup() {
+            return globalCleanup;
+        }
+
+        public JobStatus getJobStatus() {
+            return jobStatus;
+        }
     }
 
-    private CleanupJobState jobManagerRunnerFailed(JobID jobId, Throwable 
throwable) {
-        jobMasterFailed(jobId, throwable);
-        return CleanupJobState.LOCAL;
+    private CleanupJobState jobManagerRunnerFailed(
+            JobManagerRunnerResult jobManagerRunnerResult, Throwable 
throwable) {

Review Comment:
   Small question: since you're pulling `getExecutionGraphInfo().getJobId()` 
and `.getExecutionGraphInfo().getArchivedExecutionGraph().getState()` from the 
result, would it make more sense to write the type signature as:
   
   ```
   private CleanupJobState jobManagerRunnerFailed(
               ExecutionGraphInfo executionGraphInfo, Throwable throwable) {
   ```
   
   Or is passing the result in better from a readability point of view?



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to