tillrohrmann commented on a change in pull request #15159:
URL: https://github.com/apache/flink/pull/15159#discussion_r598740164



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/WaitingForResourcesTest.java
##########
@@ -178,12 +344,24 @@ void setExpectCreatingExecutionGraph() {
             creatingExecutionGraphStateValidator.expectInput(none -> {});
         }
 
-        void runScheduledTasks() {
-            for (ScheduledTask<Void> scheduledTask : scheduledTasks) {
-                scheduledTask.execute();
+        void runScheduledTasks(long untilDelay) {
+            Iterable<ScheduledTask<Void>> copyOfScheduledTasks = new 
ArrayList<>(scheduledTasks);
+            Iterator<ScheduledTask<Void>> scheduledTaskIterator = 
copyOfScheduledTasks.iterator();
+            while (scheduledTaskIterator.hasNext()) {
+                ScheduledTask<Void> scheduledTask = 
scheduledTaskIterator.next();
+                if (scheduledTask.getDelay(TimeUnit.MILLISECONDS) <= 
untilDelay) {
+                    scheduledTask.execute();
+                    if (!scheduledTask.isPeriodic()) {
+                        scheduledTaskIterator.remove();
+                    }
+                }

Review comment:
       `untilDelay` should define an upper bound for the tasks to execute if 
there is no tasks with a delay of `0` which enqueues itself over and over again.
   
   The problem with this implementation is that this might simulate an 
interleaving which cannot happen with a proper executor.




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