tillrohrmann commented on a change in pull request #15159:
URL: https://github.com/apache/flink/pull/15159#discussion_r598596260
##########
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:
I think this implementation has the problem that we are forgetting to
execute tasks which are created as part of other tasks because we copy
`scheduledTasks`.
--
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]