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 09:31:10 UTC

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

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

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