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


##########
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java:
##########
@@ -659,14 +661,34 @@ private CompletableFuture<CleanupJobState> 
handleJobManagerRunnerResult(
         return 
jobReachedTerminalState(jobManagerRunnerResult.getExecutionGraphInfo());
     }
 
-    enum CleanupJobState {
-        LOCAL,
-        GLOBAL
+    private static class CleanupJobStateWithJobStatusIfGlobal {
+
+        private static final CleanupJobStateWithJobStatusIfGlobal LOCAL = new 
CleanupJobStateWithJobStatusIfGlobal(null);
+
+        @Nullable private final JobStatus jobStatus;
+
+        public static CleanupJobStateWithJobStatusIfGlobal 
globalCleanup(JobStatus jobStatus) {
+            return new CleanupJobStateWithJobStatusIfGlobal(jobStatus);
+        }
+
+        private CleanupJobStateWithJobStatusIfGlobal(@Nullable JobStatus 
jobStatus) {
+            this.jobStatus = jobStatus;
+        }
+
+        public boolean isGlobalCleanup() {
+            return jobStatus != null;
+        }
+
+        public JobStatus getJobStatus() {
+            Preconditions.checkState(

Review Comment:
   I'm not really happy about this Precondition. But I couldn't come up with a 
better way to pass in the JobStatus without touching other method signatures. 
Do you have a better idea?



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