1996fanrui commented on code in PR #22985:
URL: https://github.com/apache/flink/pull/22985#discussion_r1349638795


##########
flink-core/src/main/java/org/apache/flink/configuration/JobManagerOptions.java:
##########
@@ -488,6 +488,23 @@ public enum SchedulerType {
                                             
code(SchedulerExecutionMode.REACTIVE.name()))
                                     .build());
 
+    @Documentation.Section(Documentation.Sections.EXPERT_SCHEDULING)
+    public static final ConfigOption<Duration> SCHEDULER_SCALING_INTERVAL_MIN =
+            key("jobmanager.adaptive-scheduler.scaling-interval.min")
+                    .durationType()
+                    .defaultValue(Duration.ofSeconds(30))
+                    // rescaling and let the user increase the value for high 
workloads
+                    .withDescription(
+                            "Determines the minimum time between scaling 
operations in reactive mode.");
+
+    @Documentation.Section(Documentation.Sections.EXPERT_SCHEDULING)
+    public static final ConfigOption<Duration> SCHEDULER_SCALING_INTERVAL_MAX =
+            key("jobmanager.adaptive-scheduler.scaling-interval.max")
+                    .durationType()
+                    .noDefaultValue()
+                    .withDescription(
+                            "Allow the user to configure the time after which 
a scaling operation is triggered regardless if the requirements are met");

Review Comment:
   ```suggestion
                               Description.builder()
                                       .text(
                                               "Define the maximum interval 
time for forced triggering a scaling operation even if the %s aren't met, the 
scaling operation will be ignored when the resource isn't changed. This option 
is disabled by default.",
                                               
code(MIN_PARALLELISM_INCREASE.key()))
                                       .build());
   ```
   
   How about this description? Also, these 2 options should be moved after the 
`MIN_PARALLELISM_INCREASE`.



##########
flink-core/src/main/java/org/apache/flink/configuration/JobManagerOptions.java:
##########
@@ -488,6 +488,23 @@ public enum SchedulerType {
                                             
code(SchedulerExecutionMode.REACTIVE.name()))
                                     .build());
 
+    @Documentation.Section(Documentation.Sections.EXPERT_SCHEDULING)

Review Comment:
   ```suggestion
       @Documentation.Section({
               Documentation.Sections.EXPERT_SCHEDULING,
               Documentation.Sections.ALL_JOB_MANAGER
       })
   ```



##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/scalingpolicy/EnforceParallelismChangeRescalingController.java:
##########
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.scheduler.adaptive.scalingpolicy;
+
+import org.apache.flink.runtime.jobgraph.JobVertexID;
+import org.apache.flink.runtime.scheduler.adaptive.allocator.VertexParallelism;
+
+/**
+ * Simple scaling policy for a reactive mode. It just checks that the new 
parallelism is different
+ * (either increase or decrease) from the current parallelism.
+ */
+public class EnforceParallelismChangeRescalingController implements 
RescalingController {

Review Comment:
   Please add some tests for this class, thanks~ 



##########
flink-core/src/main/java/org/apache/flink/configuration/JobManagerOptions.java:
##########
@@ -488,6 +488,23 @@ public enum SchedulerType {
                                             
code(SchedulerExecutionMode.REACTIVE.name()))
                                     .build());
 
+    @Documentation.Section(Documentation.Sections.EXPERT_SCHEDULING)
+    public static final ConfigOption<Duration> SCHEDULER_SCALING_INTERVAL_MIN =
+            key("jobmanager.adaptive-scheduler.scaling-interval.min")
+                    .durationType()
+                    .defaultValue(Duration.ofSeconds(30))
+                    // rescaling and let the user increase the value for high 
workloads
+                    .withDescription(
+                            "Determines the minimum time between scaling 
operations in reactive mode.");
+
+    @Documentation.Section(Documentation.Sections.EXPERT_SCHEDULING)

Review Comment:
   ```suggestion
       @Documentation.Section({
               Documentation.Sections.EXPERT_SCHEDULING,
               Documentation.Sections.ALL_JOB_MANAGER
       })
   ```



##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/scalingpolicy/EnforceParallelismChangeRescalingController.java:
##########
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.scheduler.adaptive.scalingpolicy;
+
+import org.apache.flink.runtime.jobgraph.JobVertexID;
+import org.apache.flink.runtime.scheduler.adaptive.allocator.VertexParallelism;
+
+/**
+ * Simple scaling policy for a reactive mode. It just checks that the new 
parallelism is different

Review Comment:
   Same question about this `reactive mode`.
   
   https://github.com/apache/flink/pull/22985#discussion_r1320535556



##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/Executing.java:
##########
@@ -67,13 +77,36 @@ class Executing extends StateWithExecutionGraph implements 
ResourceListener {
         this.context = context;
         Preconditions.checkState(
                 executionGraph.getState() == JobStatus.RUNNING, "Assuming 
running execution graph");
+        this.scalingIntervalMin = scalingIntervalMin;
+        this.scalingIntervalMax = scalingIntervalMax;
+        this.lastRescale =
+                Instant.now(); // Executing is recreated with each restart 
(when we rescale)
+        // we consider the first execution of the pipeline as a rescale event

Review Comment:
   nit: Would you mind moving the comment to the previous line?



-- 
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-unsubscr...@flink.apache.org

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

Reply via email to