Izeren commented on code in PR #26663:
URL: https://github.com/apache/flink/pull/26663#discussion_r2156607419


##########
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java:
##########
@@ -2932,4 +3024,54 @@ private static void checkMetrics(List<Span> results, 
boolean canRestart) {
                     .containsEntry("canRestart", String.valueOf(canRestart));
         }
     }
+
+    private static JobGraph getCheckpointingSingleVertexJobGraph(final 
JobVertex jobVertex) {
+        final JobGraph jobGraph =
+                JobGraphBuilder.newStreamingJobGraphBuilder()
+                        .addJobVertices(Collections.singletonList(jobVertex))
+                        .setJobCheckpointingSettings(
+                                new JobCheckpointingSettings(
+                                        new CheckpointCoordinatorConfiguration
+                                                        
.CheckpointCoordinatorConfigurationBuilder()
+                                                .build(),
+                                        null))
+                        .build();
+        SchedulerTestingUtils.enableCheckpointing(jobGraph);
+        return jobGraph;
+    }
+
+    private static AdaptiveScheduler.@NotNull StateTransitionManagerFactory
+            getAutoAdvanceStateTransitionManagerFactory() {
+        return (context,
+                ignoredClock,
+                ignoredCooldown,
+                ignoredResourceStabilizationTimeout,
+                ignoredMaxTriggerDelay) ->
+                TestingStateTransitionManager.withOnTriggerEventOnly(
+                        () -> {
+                            if (context instanceof WaitingForResources) {
+                                context.transitionToSubsequentState();
+                            }
+                        });
+    }
+
+    private static Map<OperatorID, OperatorSubtaskState> 
getFakeKeyedManagedStateForAllOperators(
+            final JobGraph jobGraph) throws IOException {
+        final Map<OperatorID, OperatorSubtaskState> operatorStates = new 
HashMap<>();
+        for (final JobVertex jobVertex : jobGraph.getVertices()) {
+            final KeyedStateHandle keyedStateHandle =
+                    generateKeyGroupState(jobVertex.getID(), 
KeyGroupRange.of(0, 0), true);
+            jobVertex
+                    .getOperatorIDs()
+                    .forEach(
+                            operatorID -> {
+                                operatorStates.put(
+                                        operatorID.getGeneratedOperatorID(),
+                                        OperatorSubtaskState.builder()
+                                                
.setManagedKeyedState(keyedStateHandle)
+                                                .build());
+                            });

Review Comment:
   👍 



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