venkata91 commented on PR #24736:
URL: https://github.com/apache/flink/pull/24736#issuecomment-2367214026

   To illustrate with an example test case, try changing the `executeJob` and 
`createConfiguration` with below code and run `testScheduling`:
   
   ```
   private void executeJob(Boolean useSourceParallelismInference) throws 
Exception {
           final Configuration configuration = createConfiguration();
   
           final StreamExecutionEnvironment env =
                   
StreamExecutionEnvironment.createLocalEnvironment(configuration);
           env.setRuntimeMode(RuntimeExecutionMode.BATCH);
   
           List<SlotSharingGroup> slotSharingGroups = new ArrayList<>();
   
           for (int i = 0; i < 3; ++i) {
               SlotSharingGroup group =
                       SlotSharingGroup.newBuilder("group" + i)
                               .setCpuCores(1.0)
                               .setTaskHeapMemory(MemorySize.parse("100m"))
                               .build();
               slotSharingGroups.add(group);
           }
   
           DataStream<Long> source1;
           DataStream<Long> source2;
   
           if (useSourceParallelismInference) {
               source1 =
                       env.fromSource(
                                       new 
TestingParallelismInferenceNumberSequenceSource(
                                               0, NUMBERS_TO_PRODUCE - 1, 
SOURCE_PARALLELISM_1),
                                       WatermarkStrategy.noWatermarks(),
                                       "source1")
                               .slotSharingGroup(slotSharingGroups.get(0));
               source2 =
                       env.fromSource(
                                       new 
TestingParallelismInferenceNumberSequenceSource(
                                               0, NUMBERS_TO_PRODUCE - 1, 
SOURCE_PARALLELISM_2),
                                       WatermarkStrategy.noWatermarks(),
                                       "source2")
                               .slotSharingGroup(slotSharingGroups.get(1));
           } else {
               source1 =
                       env.fromSequence(0, NUMBERS_TO_PRODUCE - 1)
                               .setParallelism(-1)
                               .name("source1")
                               .slotSharingGroup(slotSharingGroups.get(0));
               source2 =
                       env.fromSequence(0, NUMBERS_TO_PRODUCE - 1)
                               .setParallelism(-1)
                               .name("source2")
                               .slotSharingGroup(slotSharingGroups.get(1));
           }
   
           source1.union(source2)
                   .rescale()
                   .map(new NumberCounter())
                   .name("map")
                   .slotSharingGroup(slotSharingGroups.get(2));
   
           env.execute();
       }
   
       private static Configuration createConfiguration() {
           final Configuration configuration = new Configuration();
           configuration.set(RestOptions.BIND_PORT, "0");
           configuration.set(JobManagerOptions.SLOT_REQUEST_TIMEOUT, 
Duration.ofMillis(5000L));
           configuration.set(
                   
BatchExecutionOptions.ADAPTIVE_AUTO_PARALLELISM_MAX_PARALLELISM,
                   DEFAULT_MAX_PARALLELISM);
           configuration.set(
                   
BatchExecutionOptions.ADAPTIVE_AUTO_PARALLELISM_DEFAULT_SOURCE_PARALLELISM,
                   2 * DEFAULT_MAX_PARALLELISM);
           configuration.set(
                   
BatchExecutionOptions.ADAPTIVE_AUTO_PARALLELISM_AVG_DATA_VOLUME_PER_TASK,
                   MemorySize.parse("150kb"));
           configuration.set(TaskManagerOptions.MEMORY_SEGMENT_SIZE, 
MemorySize.parse("4kb"));
           configuration.set(TaskManagerOptions.NUM_TASK_SLOTS, 1);
   
           return configuration;
       }
   ```
   
   


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

Reply via email to