Dennis-Mircea commented on code in PR #1222:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/1222#discussion_r4706985567


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/validation/DefaultValidator.java:
##########
@@ -412,6 +415,46 @@ private Optional<String> 
validateTmReplicas(TaskManagerSpec tmSpec) {
         return Optional.empty();
     }
 
+    private Optional<String> validateStandaloneParallelism(
+            FlinkDeploymentSpec spec, Map<String, String> confMap) {
+        final var job = spec.getJob();
+        final var tm = spec.getTaskManager();
+        if (job == null
+                || tm == null
+                || tm.getReplicas() == null
+                || KubernetesDeploymentMode.getDeploymentMode(spec)
+                        != KubernetesDeploymentMode.STANDALONE) {
+            return Optional.empty();
+        }
+
+        final Configuration conf = Configuration.fromMap(confMap);
+        if 
(conf.get(KubernetesOperatorConfigOptions.JOB_PARALLELISM_DERIVE_FROM_REPLICAS))
 {
+            return Optional.empty();
+        }
+
+        final int slots = tm.getReplicas() * 
conf.get(TaskManagerOptions.NUM_TASK_SLOTS);
+        final int parallelism =
+                Math.max(
+                        job.getParallelism(),
+                        conf.getOptional(PipelineOptions.PARALLELISM_OVERRIDES)
+                                .flatMap(
+                                        overrides ->
+                                                overrides.values().stream()
+                                                        .map(Integer::valueOf)

Review Comment:
   The `valueOf` can throw in case of a misconfigured value, and we do not want 
to fail the whole flow for that. Better to wrap this in a try-catch block.



##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/validation/DefaultValidator.java:
##########
@@ -412,6 +415,46 @@ private Optional<String> 
validateTmReplicas(TaskManagerSpec tmSpec) {
         return Optional.empty();
     }
 
+    private Optional<String> validateStandaloneParallelism(

Review Comment:
   I'd put this logic inside validateJobSpec instead of a dedicated method, so 
it lives in the layer that makes the decision.



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