zhuzhurk commented on code in PR #24771:
URL: https://github.com/apache/flink/pull/24771#discussion_r1599433353


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptivebatch/AdaptiveBatchScheduler.java:
##########
@@ -225,17 +308,831 @@ protected void startSchedulingInternal() {
         speculativeExecutionHandler.init(
                 getExecutionGraph(), getMainThreadExecutor(), 
jobManagerJobMetricGroup);
 
+        final boolean needRecover;
+        if (isJobRecoveryEnabled) {
+            try {
+                needRecover = !jobEventManager.isEmpty();
+                jobEventManager.start();
+            } catch (Throwable throwable) {
+                this.handleGlobalFailure(new 
SuppressRestartsException(throwable));
+                return;
+            }
+        } else {
+            needRecover = false;
+        }
+
         tryComputeSourceParallelismThenRunAsync(
                 (Void value, Throwable throwable) -> {
                     if (getExecutionGraph().getState() == JobStatus.CREATED) {
-                        initializeVerticesIfPossible();
-                        super.startSchedulingInternal();
+                        if (needRecover) {
+                            
shuffleMaster.notifyPartitionRecoveryStarted(getJobId());
+                            getMainThreadExecutor()
+                                    .schedule(
+                                            this::recoverAndStartScheduling,
+                                            
previousWorkerRecoveryTimeout.toMillis(),
+                                            TimeUnit.MILLISECONDS);
+                        } else {
+                            initializeVerticesIfPossible();
+                            super.startSchedulingInternal();
+                        }
                     }
                 });
     }
 
+    private void recoverAndStartScheduling() {

Review Comment:
   Is it possible to extract the job recovery related logic to a separate class?



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