gyfora commented on code in PR #728: URL: https://github.com/apache/flink-kubernetes-operator/pull/728#discussion_r1422702163
########## flink-autoscaler/src/test/java/org/apache/flink/autoscaler/utils/AutoScalerUtilsTest.java: ########## @@ -56,4 +60,30 @@ public void testVertexExclusion() { Set.of(v1.toString(), v2.toString(), v3.toString()), new HashSet<>(conf.get(AutoScalerOptions.VERTEX_EXCLUDE_IDS))); } + + @Test + public void testForbidPeriods() { Review Comment: Should be `Forbidden` ########## flink-autoscaler/src/main/java/org/apache/flink/autoscaler/JobAutoScalerImpl.java: ########## @@ -96,6 +97,13 @@ public void scale(Context ctx) throws Exception { return; } + if (!AutoScalerUtils.verifyForbidPeriods(ctx.getConfiguration())) { Review Comment: Config validation should be in the validator module, not here. ########## flink-autoscaler/src/test/java/org/apache/flink/autoscaler/MetricsCollectionAndEvaluationTest.java: ########## @@ -599,6 +602,73 @@ public void testMetricCollectionDuringStabilization() throws Exception { assertEquals(2, stateStore.getCollectedMetrics(context).size()); } + @Test + public void testMetricCollectionDuringForbidden() throws Exception { Review Comment: I think this test should be part of the `JobAutoscalerImplTest` and then it can be simplified a lot. ########## flink-autoscaler/src/main/java/org/apache/flink/autoscaler/config/AutoScalerOptions.java: ########## @@ -72,6 +72,15 @@ private static ConfigOptions.OptionBuilder autoScalerConfig(String key) { .withDescription( "Stabilization period in which no new scaling will be executed"); + public static final ConfigOption<List<String>> FORBID_PERIOD = + autoScalerConfig("forbid.periods") + .stringType() + .asList() + .defaultValues() + .withDeprecatedKeys(deprecatedOperatorConfigKey("forbid.periods")) Review Comment: deprecated key should not be added ########## flink-autoscaler/src/main/java/org/apache/flink/autoscaler/config/AutoScalerOptions.java: ########## @@ -72,6 +72,15 @@ private static ConfigOptions.OptionBuilder autoScalerConfig(String key) { .withDescription( "Stabilization period in which no new scaling will be executed"); + public static final ConfigOption<List<String>> FORBID_PERIOD = + autoScalerConfig("forbid.periods") + .stringType() + .asList() + .defaultValues() + .withDeprecatedKeys(deprecatedOperatorConfigKey("forbid.periods")) + .withDescription( + "A (semicolon-separated) list of certain times of the day during which autoscaling is forbidden, 10:00:00-11:00:00;21:30:00-22:30:00 for example"); Review Comment: Where did you get this syntax from? What are the potential alternatives? ########## flink-autoscaler/src/main/java/org/apache/flink/autoscaler/ScalingMetricCollector.java: ########## @@ -114,6 +115,7 @@ public CollectedMetricHistory updateMetrics( var topology = getJobTopology(ctx, stateStore, jobDetailsInfo); var stableTime = jobUpdateTs.plus(conf.get(AutoScalerOptions.STABILIZATION_INTERVAL)); final boolean isStabilizing = now.isBefore(stableTime); + final boolean isForbidding = AutoScalerUtils.inForbidPeriod(conf, now); Review Comment: Everywhere the word `Forbid` should be replaced with `Forbidden` or `Blocked` to be correct. -- 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