gyfora commented on code in PR #227: URL: https://github.com/apache/flink-kubernetes-operator/pull/227#discussion_r894195379
########## flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/FlinkUtils.java: ########## @@ -278,4 +280,10 @@ public static boolean isKubernetesHAActivated(Configuration configuration) { public static boolean clusterShutdownDisabled(FlinkDeploymentSpec spec) { return spec.getFlinkVersion().isNewerVersionThan(FlinkVersion.v1_14); } + + public static int getNumTaskManagers(Configuration conf) { + int parallelism = conf.get(CoreOptions.DEFAULT_PARALLELISM); + int taskSlots = conf.get(TaskManagerOptions.NUM_TASK_SLOTS); + return (parallelism + taskSlots - 1) / taskSlots; Review Comment: In java integer division always rounds down. 5/2 would result in 2 instead of rounding up to 3 what we need to compute here. `(parallelism + taskSlots - 1) / taskSlots` is a nice trick to divide parallelism/taskslots while rounding up. -- 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