rmetzger commented on a change in pull request #15071:
URL: https://github.com/apache/flink/pull/15071#discussion_r586557298



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java
##########
@@ -248,9 +250,24 @@ public AdaptiveScheduler(
                         declarativeSlotPool::reserveFreeSlot,
                         declarativeSlotPool::freeReservedSlot);
 
-        for (JobVertex vertex : jobGraph.getVertices()) {
-            if (vertex.getParallelism() == 
ExecutionConfig.PARALLELISM_DEFAULT) {
-                vertex.setParallelism(1);
+        if (configuration.get(JobManagerOptions.SCHEDULER_MODE)
+                == SchedulerExecutionMode.REACTIVE) {
+            LOG.info("Modifying job parallelism for running in reactive 
mode.");
+            for (JobVertex vertex : jobGraph.getVertices()) {
+                if (vertex.getMaxParallelism() == 
JobVertex.MAX_PARALLELISM_DEFAULT) {
+                    
vertex.setParallelism(Transformation.UPPER_BOUND_MAX_PARALLELISM);
+                    
vertex.setMaxParallelism(Transformation.UPPER_BOUND_MAX_PARALLELISM);
+                } else {
+                    vertex.setParallelism(vertex.getMaxParallelism());
+                }
+            }
+        } else {
+            // non-reactive mode (test execution with adaptive scheduler): 
ensure parallelism is set
+            // for all vertices.
+            for (JobVertex vertex : jobGraph.getVertices()) {
+                if (vertex.getParallelism() == 
ExecutionConfig.PARALLELISM_DEFAULT) {
+                    vertex.setParallelism(1);
+                }
             }

Review comment:
       This is just an explanation for my thinking, not a counter-argument: The 
reason why I've put this here was because I assume that reactive mode is the 
only mode currently supported by the adaptive scheduler, and putting it here is 
the simplest approach (KISS-style). Once the requirements change, we can move 
this to an outside location.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to