You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "dmvk (via GitHub)" <gi...@apache.org> on 2024/01/03 12:25:30 UTC

[PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

dmvk opened a new pull request, #24021:
URL: https://github.com/apache/flink/pull/24021

   https://issues.apache.org/jira/browse/FLINK-33976


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


Re: [PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

Posted by "echauchot (via GitHub)" <gi...@apache.org>.
echauchot commented on code in PR #24021:
URL: https://github.com/apache/flink/pull/24021#discussion_r1464780022


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/Executing.java:
##########
@@ -310,22 +312,25 @@ static class Factory implements StateFactory<Executing> {
                 Logger log,
                 Context context,
                 ClassLoader userCodeClassLoader,
-                List<ExceptionHistoryEntry> failureCollection) {
+                List<ExceptionHistoryEntry> failureCollection,
+                Duration scalingIntervalMin,
+                Duration scalingIntervalMax) {

Review Comment:
   yes we test with all the 4 combinations of min/max so I agree, fair enough



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


Re: [PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

Posted by "echauchot (via GitHub)" <gi...@apache.org>.
echauchot commented on code in PR #24021:
URL: https://github.com/apache/flink/pull/24021#discussion_r1465086482


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java:
##########
@@ -177,6 +177,103 @@ public class AdaptiveScheduler
 
     private static final Logger LOG = LoggerFactory.getLogger(AdaptiveScheduler.class);
 
+    /**
+     * Consolidated settings for the adaptive scheduler. This class is used to avoid passing around
+     * multiple config options.
+     */
+    public static class Settings {

Review Comment:
   > I don't see where the SLOT_REQUEST_TIMEOUT is used by AS, can you please give me a pointer on what you have in mind?
   
   I had in mind [this line](https://github.com/dmvk/flink/blob/1f8b6548ee3686d38a23024b0de474aaf869007d/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/DefaultSlotPoolServiceSchedulerFactory.java#L200) 
   
   But, still, it might not be a good idea to put it in the AdaptiveScheduler Settings because it is used outside of AS as well for example: `ConfigurationUtils#getStandaloneClusterStartupPeriodTime` and in `JobMasterConfiguration`
   
   
   > For MIN_PARALLELISM_INCREASE, I've intentionally kept that local to EnforceMinimalIncreaseRescalingController. Ultimately the interface should be swappable (that's why it's behind an interface and constructor accepts configuration).
   
   This parameter is meaningful only in the context of `EnforceMinimalIncreaseRescalingController` for the other implementation `EnforceParallelismChangeRescalingController` it is not. I agree, we should not polluate the interface with implementation private concerns.
   
   
   > OT: I'm also starting to doubt we still need it. We've talked about it briefly with @zentol and it mostly seems to be a leftover from early work on reactive mode.
   
   OT?
   



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


Re: [PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

Posted by "dmvk (via GitHub)" <gi...@apache.org>.
dmvk merged PR #24021:
URL: https://github.com/apache/flink/pull/24021


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


Re: [PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

Posted by "dmvk (via GitHub)" <gi...@apache.org>.
dmvk commented on code in PR #24021:
URL: https://github.com/apache/flink/pull/24021#discussion_r1453774459


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/Executing.java:
##########
@@ -310,22 +312,25 @@ static class Factory implements StateFactory<Executing> {
                 Logger log,
                 Context context,
                 ClassLoader userCodeClassLoader,
-                List<ExceptionHistoryEntry> failureCollection) {
+                List<ExceptionHistoryEntry> failureCollection,
+                Duration scalingIntervalMin,
+                Duration scalingIntervalMax) {

Review Comment:
   It would make testing harder.



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


Re: [PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

Posted by "dmvk (via GitHub)" <gi...@apache.org>.
dmvk commented on code in PR #24021:
URL: https://github.com/apache/flink/pull/24021#discussion_r1453772437


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java:
##########
@@ -177,6 +177,103 @@ public class AdaptiveScheduler
 
     private static final Logger LOG = LoggerFactory.getLogger(AdaptiveScheduler.class);
 
+    /**
+     * Consolidated settings for the adaptive scheduler. This class is used to avoid passing around
+     * multiple config options.
+     */
+    public static class Settings {

Review Comment:
   I don't see where the SLOT_REQUEST_TIMEOUT is used by AS, can you please give me a pointer on what you have in mind?
   
   For MIN_PARALLELISM_INCREASE, I've intentionally kept that local to `EnforceMinimalIncreaseRescalingController`. Ultimately the interface should be swappable (that's why it's behind an interface and constructor accepts configuration).
   
   OT: I'm also starting to doubt we still need it. We've talked about it briefly with @zentol and it mostly seems to be a leftover from early work on reactive mode.



##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java:
##########
@@ -177,6 +177,103 @@ public class AdaptiveScheduler
 
     private static final Logger LOG = LoggerFactory.getLogger(AdaptiveScheduler.class);
 
+    /**
+     * Consolidated settings for the adaptive scheduler. This class is used to avoid passing around
+     * multiple config options.
+     */
+    public static class Settings {
+
+        public static Settings of(Configuration configuration) {
+            final SchedulerExecutionMode executionMode =
+                    configuration.get(JobManagerOptions.SCHEDULER_MODE);
+            Duration allocationTimeoutDefault =
+                    JobManagerOptions.RESOURCE_WAIT_TIMEOUT.defaultValue();
+            Duration stabilizationTimeoutDefault =
+                    JobManagerOptions.RESOURCE_STABILIZATION_TIMEOUT.defaultValue();
+            if (executionMode == SchedulerExecutionMode.REACTIVE) {
+                allocationTimeoutDefault = Duration.ofMillis(-1);
+                stabilizationTimeoutDefault = Duration.ZERO;
+            }

Review Comment:
   removing the old code path, it's no longer used



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


Re: [PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #24021:
URL: https://github.com/apache/flink/pull/24021#issuecomment-1875300830

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4cd91bc6028e0a5e78e4a7984201fa6eca84232f",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "4cd91bc6028e0a5e78e4a7984201fa6eca84232f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4cd91bc6028e0a5e78e4a7984201fa6eca84232f UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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


Re: [PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

Posted by "echauchot (via GitHub)" <gi...@apache.org>.
echauchot commented on code in PR #24021:
URL: https://github.com/apache/flink/pull/24021#discussion_r1465056106


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java:
##########
@@ -177,6 +177,103 @@ public class AdaptiveScheduler
 
     private static final Logger LOG = LoggerFactory.getLogger(AdaptiveScheduler.class);
 
+    /**
+     * Consolidated settings for the adaptive scheduler. This class is used to avoid passing around
+     * multiple config options.
+     */
+    public static class Settings {

Review Comment:
   > I don't see where the SLOT_REQUEST_TIMEOUT is used by AS, can you please give me a pointer on what you have in mind?
   
   I had in mind [this line](https://github.com/dmvk/flink/blob/1f8b6548ee3686d38a23024b0de474aaf869007d/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/DefaultSlotPoolServiceSchedulerFactory.java#L200) 
   
   But, still, it might not be a good idea to put it in the AdaptiveScheduler Settings because it is used outside of AS as well for example: `ConfigurationUtils#getStandaloneClusterStartupPeriodTime` and in `JobMasterConfiguration`
   
   
   > For MIN_PARALLELISM_INCREASE, I've intentionally kept that local to EnforceMinimalIncreaseRescalingController. Ultimately the interface should be swappable (that's why it's behind an interface and constructor accepts configuration).
   
   This parameter is meaningful only in the context of `EnforceMinimalIncreaseRescalingController` for the other implementation `EnforceParallelismChangeRescalingController` it is not. I agree, we should not polluate the interface with implementation private concerns.
   
   
   > OT: I'm also starting to doubt we still need it. We've talked about it briefly with @zentol and it mostly seems to be a leftover from early work on reactive mode.
   
   OT?
   



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


Re: [PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

Posted by "echauchot (via GitHub)" <gi...@apache.org>.
echauchot commented on code in PR #24021:
URL: https://github.com/apache/flink/pull/24021#discussion_r1465056106


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java:
##########
@@ -177,6 +177,103 @@ public class AdaptiveScheduler
 
     private static final Logger LOG = LoggerFactory.getLogger(AdaptiveScheduler.class);
 
+    /**
+     * Consolidated settings for the adaptive scheduler. This class is used to avoid passing around
+     * multiple config options.
+     */
+    public static class Settings {

Review Comment:
   > I don't see where the SLOT_REQUEST_TIMEOUT is used by AS, can you please give me a pointer on what you have in mind?
   
   I had in mind [this line](https://github.com/dmvk/flink/blob/1f8b6548ee3686d38a23024b0de474aaf869007d/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/DefaultSlotPoolServiceSchedulerFactory.java#L200) 
   
   But, still, it might not be a good idea to put it in the AdaptiveScheduler Settings because it is used outside of AS as well for example: `ConfigurationUtils#getStandaloneClusterStartupPeriodTime` and in `JobMasterConfiguration`
   
   
   > For MIN_PARALLELISM_INCREASE, I've intentionally kept that local to EnforceMinimalIncreaseRescalingController. Ultimately the interface should be swappable (that's why it's behind an interface and constructor accepts configuration).
   
   This parameter is meaningful only in the context of `EnforceMinimalIncreaseRescalingController` for the other implementation `EnforceParallelismChangeRescalingController` it is not. I agree, we should not polluate the interface with implementation private concerns.
   
   
   > OT: I'm also starting to doubt we still need it. We've talked about it briefly with @zentol and it mostly seems to be a leftover from early work on reactive mode.
   
   OT?
   



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


Re: [PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

Posted by "echauchot (via GitHub)" <gi...@apache.org>.
echauchot commented on code in PR #24021:
URL: https://github.com/apache/flink/pull/24021#discussion_r1465056106


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java:
##########
@@ -177,6 +177,103 @@ public class AdaptiveScheduler
 
     private static final Logger LOG = LoggerFactory.getLogger(AdaptiveScheduler.class);
 
+    /**
+     * Consolidated settings for the adaptive scheduler. This class is used to avoid passing around
+     * multiple config options.
+     */
+    public static class Settings {

Review Comment:
   > I don't see where the SLOT_REQUEST_TIMEOUT is used by AS, can you please give me a pointer on what you have in mind?
   
   I had in mind [this line](https://github.com/dmvk/flink/blob/1f8b6548ee3686d38a23024b0de474aaf869007d/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/DefaultSlotPoolServiceSchedulerFactory.java#L200) 
   
   > For MIN_PARALLELISM_INCREASE, I've intentionally kept that local to EnforceMinimalIncreaseRescalingController. Ultimately the interface should be swappable (that's why it's behind an interface and constructor accepts configuration).
   
   I agree, this parameter is meaningful only in the context of `EnforceMinimalIncreaseRescalingController` for the other implementation `EnforceParallelismChangeRescalingController` it is not. Let's not polluate the interface with implementation private concerns.
   
   
   > OT: I'm also starting to doubt we still need it. We've talked about it briefly with @zentol and it mostly seems to be a leftover from early work on reactive mode.
   
   OT?
   



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


Re: [PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

Posted by "echauchot (via GitHub)" <gi...@apache.org>.
echauchot commented on code in PR #24021:
URL: https://github.com/apache/flink/pull/24021#discussion_r1464780022


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/Executing.java:
##########
@@ -310,22 +312,25 @@ static class Factory implements StateFactory<Executing> {
                 Logger log,
                 Context context,
                 ClassLoader userCodeClassLoader,
-                List<ExceptionHistoryEntry> failureCollection) {
+                List<ExceptionHistoryEntry> failureCollection,
+                Duration scalingIntervalMin,
+                Duration scalingIntervalMax) {

Review Comment:
   Agree, fair enough



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


Re: [PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

Posted by "dmvk (via GitHub)" <gi...@apache.org>.
dmvk commented on PR #24021:
URL: https://github.com/apache/flink/pull/24021#issuecomment-1914911611

   Can't reply inline for some reason :)
   
   > I had in mind [this line](https://github.com/dmvk/flink/blob/1f8b6548ee3686d38a23024b0de474aaf869007d/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/DefaultSlotPoolServiceSchedulerFactory.java#L200)
   
   That's for the batch scheduler.
   
   > OT
   
   offtopic haha :D 


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


Re: [PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

Posted by "echauchot (via GitHub)" <gi...@apache.org>.
echauchot commented on code in PR #24021:
URL: https://github.com/apache/flink/pull/24021#discussion_r1441617011


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java:
##########
@@ -177,6 +177,103 @@ public class AdaptiveScheduler
 
     private static final Logger LOG = LoggerFactory.getLogger(AdaptiveScheduler.class);
 
+    /**
+     * Consolidated settings for the adaptive scheduler. This class is used to avoid passing around
+     * multiple config options.
+     */
+    public static class Settings {

Review Comment:
   Shouldn't these parameters be part on the Settings object as they are part of the adaptive scheduler configuration ?
   
   - SLOT_REQUEST_TIMEOUT 
   - MIN_PARALLELISM_INCREASE



##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java:
##########
@@ -177,6 +177,103 @@ public class AdaptiveScheduler
 
     private static final Logger LOG = LoggerFactory.getLogger(AdaptiveScheduler.class);
 
+    /**
+     * Consolidated settings for the adaptive scheduler. This class is used to avoid passing around
+     * multiple config options.
+     */
+    public static class Settings {
+
+        public static Settings of(Configuration configuration) {
+            final SchedulerExecutionMode executionMode =
+                    configuration.get(JobManagerOptions.SCHEDULER_MODE);
+            Duration allocationTimeoutDefault =
+                    JobManagerOptions.RESOURCE_WAIT_TIMEOUT.defaultValue();
+            Duration stabilizationTimeoutDefault =
+                    JobManagerOptions.RESOURCE_STABILIZATION_TIMEOUT.defaultValue();
+            if (executionMode == SchedulerExecutionMode.REACTIVE) {
+                allocationTimeoutDefault = Duration.ofMillis(-1);
+                stabilizationTimeoutDefault = Duration.ZERO;
+            }
+
+            final Duration scalingIntervalMin =
+                    configuration.get(JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MIN);
+            final Duration scalingIntervalMax =
+                    configuration.get(JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MAX);
+            Preconditions.checkState(
+                    !scalingIntervalMin.isNegative(),
+                    "%s must be positive integer or 0",
+                    JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MIN.key());
+            if (scalingIntervalMax != null) {
+                Preconditions.checkState(
+                        scalingIntervalMax.compareTo(scalingIntervalMin) > 0,
+                        "%s(%d) must be greater than %s(%d)",
+                        JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MAX.key(),
+                        scalingIntervalMax,
+                        JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MIN.key(),
+                        scalingIntervalMin);
+            }
+
+            return new Settings(
+                    executionMode,
+                    configuration
+                            .getOptional(JobManagerOptions.RESOURCE_WAIT_TIMEOUT)
+                            .orElse(allocationTimeoutDefault),

Review Comment:
   same here the code is also in `DefaultSlotPoolServiceSchedulerFactory`



##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/Executing.java:
##########
@@ -310,22 +312,25 @@ static class Factory implements StateFactory<Executing> {
                 Logger log,
                 Context context,
                 ClassLoader userCodeClassLoader,
-                List<ExceptionHistoryEntry> failureCollection) {
+                List<ExceptionHistoryEntry> failureCollection,
+                Duration scalingIntervalMin,
+                Duration scalingIntervalMax) {

Review Comment:
   introducing Settings object was to avoid passing around individual parameters. Should we not pass a Settings instance here even if we use only 2 of its parameters ?



##########
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerClusterITCase.java:
##########
@@ -88,8 +88,8 @@ private Configuration createConfiguration() {
         final Configuration configuration = new Configuration();
 
         configuration.set(JobManagerOptions.SCHEDULER, JobManagerOptions.SchedulerType.Adaptive);
-        configuration.set(
-                JobManagerOptions.RESOURCE_STABILIZATION_TIMEOUT, Duration.ofMillis(100L));
+        configuration.set(JobManagerOptions.RESOURCE_STABILIZATION_TIMEOUT, Duration.ofMillis(1L));
+        configuration.set(JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MIN, Duration.ofMillis(1L));

Review Comment:
   Same as in the unit test, nice to avoid using the too long default value in the test. :+1: 



##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java:
##########
@@ -177,6 +177,103 @@ public class AdaptiveScheduler
 
     private static final Logger LOG = LoggerFactory.getLogger(AdaptiveScheduler.class);
 
+    /**
+     * Consolidated settings for the adaptive scheduler. This class is used to avoid passing around
+     * multiple config options.
+     */
+    public static class Settings {
+
+        public static Settings of(Configuration configuration) {
+            final SchedulerExecutionMode executionMode =
+                    configuration.get(JobManagerOptions.SCHEDULER_MODE);
+            Duration allocationTimeoutDefault =
+                    JobManagerOptions.RESOURCE_WAIT_TIMEOUT.defaultValue();
+            Duration stabilizationTimeoutDefault =
+                    JobManagerOptions.RESOURCE_STABILIZATION_TIMEOUT.defaultValue();
+            if (executionMode == SchedulerExecutionMode.REACTIVE) {
+                allocationTimeoutDefault = Duration.ofMillis(-1);
+                stabilizationTimeoutDefault = Duration.ZERO;
+            }
+
+            final Duration scalingIntervalMin =
+                    configuration.get(JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MIN);
+            final Duration scalingIntervalMax =
+                    configuration.get(JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MAX);
+            Preconditions.checkState(
+                    !scalingIntervalMin.isNegative(),
+                    "%s must be positive integer or 0",
+                    JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MIN.key());
+            if (scalingIntervalMax != null) {
+                Preconditions.checkState(
+                        scalingIntervalMax.compareTo(scalingIntervalMin) > 0,
+                        "%s(%d) must be greater than %s(%d)",
+                        JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MAX.key(),
+                        scalingIntervalMax,
+                        JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MIN.key(),
+                        scalingIntervalMin);
+            }
+
+            return new Settings(
+                    executionMode,
+                    configuration
+                            .getOptional(JobManagerOptions.RESOURCE_WAIT_TIMEOUT)
+                            .orElse(allocationTimeoutDefault),
+                    configuration
+                            .getOptional(JobManagerOptions.RESOURCE_STABILIZATION_TIMEOUT)
+                            .orElse(stabilizationTimeoutDefault),
+                    Duration.ofMillis(configuration.get(JobManagerOptions.SLOT_IDLE_TIMEOUT)),
+                    scalingIntervalMin,
+                    scalingIntervalMax);
+        }
+
+        private final SchedulerExecutionMode executionMode;
+        private final Duration initialResourceAllocationTimeout;
+        private final Duration resourceStabilizationTimeout;
+        private final Duration slotIdleTimeout;
+        private final Duration scalingIntervalMin;
+        private final Duration scalingIntervalMax;
+
+        public Settings(

Review Comment:
   the constructor should be private as there is the `of()` factory method



##########
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java:
##########
@@ -1278,27 +1273,23 @@ void testRequirementLowerBoundDecreaseAfterResourceScarcityBelowAvailableSlots()
         awaitJobReachingParallelism(taskManagerGateway, scheduler, availableSlots);
     }
 
-    private AdaptiveSchedulerBuilder prepareScheduler(
-            JobGraph jobGraph, DeclarativeSlotPool declarativeSlotPool) {
-        return new AdaptiveSchedulerBuilder(
-                        jobGraph, singleThreadMainThreadExecutor, EXECUTOR_RESOURCE.getExecutor())
-                .setDeclarativeSlotPool(declarativeSlotPool);
-    }
-
-    private static Configuration getConfigurationWithNoResourceWaitTimeout() {
+    private static Configuration createConfigurationWithNoTimeouts() {
         return new Configuration()
-                .set(JobManagerOptions.RESOURCE_WAIT_TIMEOUT, Duration.ofMillis(1L));
+                .set(JobManagerOptions.RESOURCE_WAIT_TIMEOUT, Duration.ofMillis(1L))
+                .set(JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MIN, Duration.ofMillis(1L));

Review Comment:
   Indeed, the new cooldown period has default value of 30s and it is set to a lower value only in `ExecutingTest`. So in `AdaptiveSchedulerTest` the default value slows down the tests as a side effect. Good catch ! :+1: 



##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/Executing.java:
##########
@@ -310,22 +312,25 @@ static class Factory implements StateFactory<Executing> {
                 Logger log,
                 Context context,
                 ClassLoader userCodeClassLoader,
-                List<ExceptionHistoryEntry> failureCollection) {
+                List<ExceptionHistoryEntry> failureCollection,
+                Duration scalingIntervalMin,
+                Duration scalingIntervalMax) {
             this.context = context;
             this.log = log;
             this.executionGraph = executionGraph;
             this.executionGraphHandler = executionGraphHandler;
             this.operatorCoordinatorHandler = operatorCoordinatorHandler;
             this.userCodeClassLoader = userCodeClassLoader;
             this.failureCollection = failureCollection;
+            this.scalingIntervalMin = scalingIntervalMin;
+            this.scalingIntervalMax = scalingIntervalMax;
         }
 
         public Class<Executing> getStateClass() {
             return Executing.class;
         }
 
         public Executing getState() {
-            final Configuration jobConfiguration = executionGraph.getJobConfiguration();

Review Comment:
   Here lies the error we fix in this ticket. Thanks for catching it ! :+1: 



##########
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java:
##########
@@ -1278,27 +1273,23 @@ void testRequirementLowerBoundDecreaseAfterResourceScarcityBelowAvailableSlots()
         awaitJobReachingParallelism(taskManagerGateway, scheduler, availableSlots);
     }
 
-    private AdaptiveSchedulerBuilder prepareScheduler(
-            JobGraph jobGraph, DeclarativeSlotPool declarativeSlotPool) {
-        return new AdaptiveSchedulerBuilder(
-                        jobGraph, singleThreadMainThreadExecutor, EXECUTOR_RESOURCE.getExecutor())
-                .setDeclarativeSlotPool(declarativeSlotPool);
-    }
-
-    private static Configuration getConfigurationWithNoResourceWaitTimeout() {
+    private static Configuration createConfigurationWithNoTimeouts() {
         return new Configuration()
-                .set(JobManagerOptions.RESOURCE_WAIT_TIMEOUT, Duration.ofMillis(1L));
+                .set(JobManagerOptions.RESOURCE_WAIT_TIMEOUT, Duration.ofMillis(1L))
+                .set(JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MIN, Duration.ofMillis(1L));
     }
 
-    private AdaptiveSchedulerBuilder prepareSchedulerWithNoResourceWaitTimeout(
+    private AdaptiveSchedulerBuilder prepareSchedulerWithNoTimeouts(

Review Comment:
   Indeed, better to configure the scheduler with no timeouts for all the tests now ! :+1: 



##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java:
##########
@@ -177,6 +177,103 @@ public class AdaptiveScheduler
 
     private static final Logger LOG = LoggerFactory.getLogger(AdaptiveScheduler.class);
 
+    /**
+     * Consolidated settings for the adaptive scheduler. This class is used to avoid passing around
+     * multiple config options.
+     */
+    public static class Settings {
+
+        public static Settings of(Configuration configuration) {
+            final SchedulerExecutionMode executionMode =
+                    configuration.get(JobManagerOptions.SCHEDULER_MODE);
+            Duration allocationTimeoutDefault =
+                    JobManagerOptions.RESOURCE_WAIT_TIMEOUT.defaultValue();
+            Duration stabilizationTimeoutDefault =
+                    JobManagerOptions.RESOURCE_STABILIZATION_TIMEOUT.defaultValue();
+            if (executionMode == SchedulerExecutionMode.REACTIVE) {
+                allocationTimeoutDefault = Duration.ofMillis(-1);
+                stabilizationTimeoutDefault = Duration.ZERO;
+            }
+
+            final Duration scalingIntervalMin =
+                    configuration.get(JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MIN);
+            final Duration scalingIntervalMax =
+                    configuration.get(JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MAX);
+            Preconditions.checkState(
+                    !scalingIntervalMin.isNegative(),
+                    "%s must be positive integer or 0",
+                    JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MIN.key());
+            if (scalingIntervalMax != null) {
+                Preconditions.checkState(
+                        scalingIntervalMax.compareTo(scalingIntervalMin) > 0,
+                        "%s(%d) must be greater than %s(%d)",
+                        JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MAX.key(),
+                        scalingIntervalMax,
+                        JobManagerOptions.SCHEDULER_SCALING_INTERVAL_MIN.key(),
+                        scalingIntervalMin);
+            }

Review Comment:
   Same here, this code is also in `Executing` constructor



##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java:
##########
@@ -177,6 +177,103 @@ public class AdaptiveScheduler
 
     private static final Logger LOG = LoggerFactory.getLogger(AdaptiveScheduler.class);
 
+    /**
+     * Consolidated settings for the adaptive scheduler. This class is used to avoid passing around
+     * multiple config options.
+     */
+    public static class Settings {
+
+        public static Settings of(Configuration configuration) {
+            final SchedulerExecutionMode executionMode =
+                    configuration.get(JobManagerOptions.SCHEDULER_MODE);
+            Duration allocationTimeoutDefault =
+                    JobManagerOptions.RESOURCE_WAIT_TIMEOUT.defaultValue();
+            Duration stabilizationTimeoutDefault =
+                    JobManagerOptions.RESOURCE_STABILIZATION_TIMEOUT.defaultValue();
+            if (executionMode == SchedulerExecutionMode.REACTIVE) {
+                allocationTimeoutDefault = Duration.ofMillis(-1);
+                stabilizationTimeoutDefault = Duration.ZERO;
+            }

Review Comment:
   This code is already present in the `DefaultSlotPoolServiceSchedulerFactory#getAdaptiveSchedulerFactoryFromConfiguration`, shouldn't we keep this kind of default value computation in a single place?



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


Re: [PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

Posted by "echauchot (via GitHub)" <gi...@apache.org>.
echauchot commented on code in PR #24021:
URL: https://github.com/apache/flink/pull/24021#discussion_r1465056106


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java:
##########
@@ -177,6 +177,103 @@ public class AdaptiveScheduler
 
     private static final Logger LOG = LoggerFactory.getLogger(AdaptiveScheduler.class);
 
+    /**
+     * Consolidated settings for the adaptive scheduler. This class is used to avoid passing around
+     * multiple config options.
+     */
+    public static class Settings {

Review Comment:
   > I don't see where the SLOT_REQUEST_TIMEOUT is used by AS, can you please give me a pointer on what you have in mind?
   
   I had in mind [this line](https://github.com/dmvk/flink/blob/1f8b6548ee3686d38a23024b0de474aaf869007d/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/DefaultSlotPoolServiceSchedulerFactory.java#L200) 
   
   > For MIN_PARALLELISM_INCREASE, I've intentionally kept that local to EnforceMinimalIncreaseRescalingController. Ultimately the interface should be swappable (that's why it's behind an interface and constructor accepts configuration).
   
   This parameter is meaningful only in the context of `EnforceMinimalIncreaseRescalingController` for the other implementation `EnforceParallelismChangeRescalingController` it is not. I agree, we should not polluate the interface with implementation private concerns.
   
   
   > OT: I'm also starting to doubt we still need it. We've talked about it briefly with @zentol and it mostly seems to be a leftover from early work on reactive mode.
   
   OT?
   



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


Re: [PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

Posted by "echauchot (via GitHub)" <gi...@apache.org>.
echauchot commented on PR #24021:
URL: https://github.com/apache/flink/pull/24021#issuecomment-1908352008

   @flinkbot run azure


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


Re: [PR] [FLINK-33976] AdaptiveScheduler cooldown period should be taken from JobManager's configuration [flink]

Posted by "echauchot (via GitHub)" <gi...@apache.org>.
echauchot commented on PR #24021:
URL: https://github.com/apache/flink/pull/24021#issuecomment-1875401922

   Hi David, thanks for this PR, I'll take a look


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