SamBarker commented on code in PR #904:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/904#discussion_r1811604794
##########
flink-autoscaler/src/test/java/org/apache/flink/autoscaler/JobVertexScalerTest.java:
##########
@@ -1004,6 +1036,38 @@ public void testNumPartitionsAdjustment() {
parallelismUpperLimit,
eventCollector,
context));
+
+ assertEquals(
+ 199,
+ JobVertexScaler.scale(
+ vertex,
+ 24,
+ List.of(),
+ 199,
+ 256,
+ 4,
+ parallelismLowerLimit,
+ parallelismUpperLimit,
+ eventCollector,
+ context));
+
+ Configuration conf = context.getConfiguration();
+ conf.set(
+ AutoScalerOptions.SCALING_KEY_GROUP_PARTITIONS_ADJUST_MODE,
+
NumKeyGroupsOrPartitionsParallelismAdjuster.Mode.MAXIMIZE_UTILISATION);
+ assertEquals(
+ 100,
Review Comment:
```suggestion
MAXIMUM_UTILISATION_PARALLELISM,
```
Its not the number that matters but what it means.
##########
flink-autoscaler/src/test/java/org/apache/flink/autoscaler/JobVertexScalerTest.java:
##########
@@ -379,6 +379,38 @@ public void testParallelismComputationWithAdjustment(
maxParallelism,
eventCollector,
context));
+
+ assertEquals(
+ 32,
Review Comment:
It would be nice to tie this answer to something so it was clear why it was
picked.
e.g.
```suggestion
EXPECTED_KEY_GROUPS,
```
##########
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/NumKeyGroupsOrPartitionsParallelismAdjuster.java:
##########
@@ -0,0 +1,134 @@
+/*
+ * 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.autoscaler;
+
+import org.apache.flink.autoscaler.config.AutoScalerOptions;
+import org.apache.flink.autoscaler.event.AutoScalerEventHandler;
+import org.apache.flink.configuration.DescribedEnum;
+import org.apache.flink.configuration.description.InlineElement;
+import org.apache.flink.runtime.jobgraph.JobVertexID;
+
+import static
org.apache.flink.autoscaler.JobVertexScaler.SCALE_LIMITED_MESSAGE_FORMAT;
+import static org.apache.flink.autoscaler.JobVertexScaler.SCALING_LIMITED;
+import static
org.apache.flink.autoscaler.config.AutoScalerOptions.SCALING_EVENT_INTERVAL;
+import static org.apache.flink.configuration.description.TextElement.text;
+
+/**
+ * Component responsible adjusts the parallelism of a vertex that knows the
number of partitions or
+ * a vertex whose upstream shuffle is key by.
+ */
+public class NumKeyGroupsOrPartitionsParallelismAdjuster {
Review Comment:
To me the number of key groups or partitions is an implementation details
the role this class plays is simply:
```suggestion
public class ParallelismAdjuster {
```
One could make an argument for an interface with an implementation named
`PartitionBoundedParallelismAdjuster` or `KeyGroupBoundedParallelismAdjuster`
but I don't have any context to suggest that is required at this point. Having
said that the fact we have an enum and thus two implementations already maybe
it jus justified.
##########
flink-autoscaler/src/test/java/org/apache/flink/autoscaler/JobVertexScalerTest.java:
##########
@@ -1004,6 +1036,38 @@ public void testNumPartitionsAdjustment() {
parallelismUpperLimit,
eventCollector,
context));
+
+ assertEquals(
+ 199,
Review Comment:
```suggestion
PARTITION_COUNT,
```
--
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]