ifndef-SleePy commented on a change in pull request #9072: [FLINK-11630] Wait
for the termination of all running Tasks when shutting down TaskExecutor
URL: https://github.com/apache/flink/pull/9072#discussion_r314245975
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
##########
@@ -1826,4 +1838,30 @@ public SlotReport retrievePayload(ResourceID
resourceID) {
return taskSlotTable.createSlotReport(getResourceID());
}
}
+
+ private static class TaskCompletionTracker {
+ private final Map<ExecutionAttemptID, Task> incompleteTasks;
+
+ private TaskCompletionTracker() {
+ incompleteTasks = new ConcurrentHashMap<>(8);
+ }
+
+ void trackTaskCompletion(Task task) {
+ incompleteTasks.put(task.getExecutionId(), task);
+ task.getTerminationFuture().thenRun(() ->
incompleteTasks.remove(task.getExecutionId()));
Review comment:
Yes, Andrey has explained to me before.
Never mind, it's just a mention when I saw this comment. I agree that we
could follow up on it later.
BTW, we could also avoid concurrent modifications through `thenRunAsync`
with `mainThreadExecutor` if we prefer relying on `task.getTerminationFuture()`.
----------------------------------------------------------------
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]
With regards,
Apache Git Services