mxm commented on code in PR #783:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/783#discussion_r1502221272
##########
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/JobVertexScaler.java:
##########
@@ -245,50 +247,69 @@ private boolean detectIneffectiveScaleUp(
}
}
+ /**
+ * Compute newParallelism according to currentParallelism.
+ *
+ * @param currentParallelism The current parallelism.
+ * @param maxParallelism The max parallelism for job vertices. It's
numKeyGroups by default, and
+ * it's partition number for kafka source vertex.
+ * @param scaleFactor The scale factor.
+ * @param parallelismLowerLimit The parallelism lower limitation in
autoscaler option.
+ * @param parallelismUpperLimit The parallelism upper limitation in
autoscaler option.
+ * @param adjustByMaxParallelism True means we need to adjust parallelism
according to the
+ * maxParallelism to ensure the keyGroup or partition evenly.
+ */
Review Comment:
I prefer adding just an explanation of what this method does. There is no
additional information which is not already in the method signature. If we want
to clarify, e.g. maxParallelism, we can add a dedicated comment for that.
##########
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/JobVertexScaler.java:
##########
@@ -71,6 +71,7 @@ public JobVertexScaler(AutoScalerEventHandler<KEY, Context>
autoScalerEventHandl
public int computeScaleTargetParallelism(
Context context,
JobVertexID vertex,
+ boolean adjustByMaxParallelism,
Review Comment:
Can we pass-through the ShipStrategy here? That way we decide not based on
some boolean but on the relevant data for making the key group adjustment
decision. Also makes unit testing more solid.
##########
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/topology/ShipStrategy.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * 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.topology;
+
+import javax.annotation.Nonnull;
+
+/** The ship strategy between 2 JobVertices. */
+public enum ShipStrategy {
Review Comment:
Would be nice to reuse Flink's ShipStrategyType if possible.
--
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]