tillrohrmann 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_r314237091
##########
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:
Andrey explained to me that we call `unregisterTaskAndNotifyFinalState`
before the clean up of the `Task` has completed. I think this is a problem in
the `Task's` lifecycle. Hence, one could fix this as a follow up and then
simply use the `TerminationFuture` to signal the final state to the
`TaskExecutor`. But this is out of scope for this PR.
----------------------------------------------------------------
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