echauchot commented on code in PR #22985:
URL: https://github.com/apache/flink/pull/22985#discussion_r1358317366


##########
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
+        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);
+        }
 
         deploy();
 
         // check if new resources have come available in the meantime
         context.runIfState(this, this::maybeRescale, Duration.ZERO);
     }
 
+    @VisibleForTesting
+    void setLastRescale(Instant lastRescale) {

Review Comment:
   No because `lastRescale` is never passed from the outside of the Executing 
object in production code: it is only initialized at the creation of Executing. 
`setLastRescale` is only used in test code. Changing a production constructor 
just for a test case is a bad design.



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