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


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptivebatch/AdaptiveBatchScheduler.java:
##########
@@ -232,8 +230,8 @@ protected void startSchedulingInternal() {
                     }
                 });
 
-        speculativeExecutionHandler.startSlowTaskDetector(
-                getExecutionGraph(), getMainThreadExecutor());
+        speculativeExecutionHandler.init(

Review Comment:
   I prefer this to happen at the beginning of `startSchedulingInternal`, doing 
initialization before triggering scheduling.



##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptivebatch/AdaptiveBatchSchedulerFactory.java:
##########
@@ -162,6 +147,74 @@ public SchedulerNG createInstance(
                 jobGraph.getName(),
                 jobGraph.getJobID());
 
+        return createScheduler(
+                log,
+                jobGraph,
+                ioExecutor,
+                jobMasterConfiguration,
+                futureExecutor,
+                userCodeLoader,
+                checkpointRecoveryFactory,
+                rpcTimeout,
+                blobWriter,
+                jobManagerJobMetricGroup,
+                shuffleMaster,
+                partitionTracker,
+                executionDeploymentTracker,
+                initializationTimestamp,
+                mainThreadExecutor,
+                jobStatusListener,
+                failureEnrichers,
+                blocklistOperations,
+                new DefaultExecutionOperations(),
+                allocatorFactory,
+                restartBackoffTimeStrategy,
+                new ScheduledExecutorServiceAdapter(futureExecutor),
+                DefaultVertexParallelismAndInputInfosDecider.from(
+                        getDefaultMaxParallelism(jobMasterConfiguration, 
executionConfig),
+                        jobMasterConfiguration));
+    }
+
+    public AdaptiveBatchScheduler createScheduler(

Review Comment:
   Better to be static and `@VisibleForTesting`.



##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptivebatch/AdaptiveBatchSchedulerFactory.java:
##########
@@ -162,6 +147,74 @@ public SchedulerNG createInstance(
                 jobGraph.getName(),
                 jobGraph.getJobID());
 
+        return createScheduler(
+                log,
+                jobGraph,
+                ioExecutor,
+                jobMasterConfiguration,
+                futureExecutor,
+                userCodeLoader,
+                checkpointRecoveryFactory,
+                rpcTimeout,
+                blobWriter,
+                jobManagerJobMetricGroup,
+                shuffleMaster,
+                partitionTracker,
+                executionDeploymentTracker,
+                initializationTimestamp,
+                mainThreadExecutor,
+                jobStatusListener,
+                failureEnrichers,
+                blocklistOperations,
+                new DefaultExecutionOperations(),
+                allocatorFactory,
+                restartBackoffTimeStrategy,
+                new ScheduledExecutorServiceAdapter(futureExecutor),
+                DefaultVertexParallelismAndInputInfosDecider.from(
+                        getDefaultMaxParallelism(jobMasterConfiguration, 
executionConfig),
+                        jobMasterConfiguration));
+    }
+
+    public AdaptiveBatchScheduler createScheduler(
+            Logger log,
+            JobGraph jobGraph,
+            Executor ioExecutor,
+            Configuration jobMasterConfiguration,
+            ScheduledExecutorService futureExecutor,
+            ClassLoader userCodeLoader,
+            CheckpointRecoveryFactory checkpointRecoveryFactory,
+            Time rpcTimeout,
+            BlobWriter blobWriter,
+            JobManagerJobMetricGroup jobManagerJobMetricGroup,
+            ShuffleMaster<?> shuffleMaster,
+            JobMasterPartitionTracker partitionTracker,
+            ExecutionDeploymentTracker executionDeploymentTracker,
+            long initializationTimestamp,
+            ComponentMainThreadExecutor mainThreadExecutor,
+            JobStatusListener jobStatusListener,
+            Collection<FailureEnricher> failureEnrichers,
+            BlocklistOperations blocklistOperations,
+            ExecutionOperations executionOperations,
+            ExecutionSlotAllocatorFactory allocatorFactory,
+            RestartBackoffTimeStrategy restartBackoffTimeStrategy,
+            ScheduledExecutor delayExecutor,
+            VertexParallelismAndInputInfosDecider 
vertexParallelismAndInputInfosDecider)
+            throws Exception {
+
+        checkState(
+                jobGraph.getJobType() == JobType.BATCH,
+                "Adaptive batch scheduler only supports batch jobs");
+        checkAllExchangesAreSupported(jobGraph);
+
+        final boolean enableSpeculativeExecution =
+                
jobMasterConfiguration.get(BatchExecutionOptions.SPECULATIVE_ENABLED);
+
+        final HybridPartitionDataConsumeConstraint 
hybridPartitionDataConsumeConstraint =
+                getOrDecideHybridPartitionDataConsumeConstraint(
+                        jobMasterConfiguration, enableSpeculativeExecution);
+
+        final Consumer<ComponentMainThreadExecutor> combinedStartUpActions = m 
-> {};

Review Comment:
   It's no longer a **combined**StartUpActions. Maybe directly pass `m -> {}` 
as the ctor param?



##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptivebatch/AdaptiveBatchSchedulerFactory.java:
##########
@@ -182,6 +235,9 @@ public SchedulerNG createInstance(
                 new VertexwiseSchedulingStrategy.Factory(
                         
loadInputConsumableDeciderFactory(hybridPartitionDataConsumeConstraint));
 
+        ExecutionConfig executionConfig =

Review Comment:
   Let’s avoid deserializing it twice in production.



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