You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/04/26 10:25:56 UTC

[GitHub] [flink] XComp commented on a diff in pull request #19567: [FLINK-27382][runtime] Moves cluster shutdown to when the job cleanup is done in job mode

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


##########
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:
   yikes, you have a point. But while looking into it I noticed that I did something stupid here: I used the `jobManagerRunnerResult` for `jobManagerRunnerFailed` in the case where `jobManagerRunnerResult` is actually `null`. I fixed this now. But I'm gonna double-check why this never came up in any test...



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org