XComp commented on a change in pull request #18536:
URL: https://github.com/apache/flink/pull/18536#discussion_r798437837
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java
##########
@@ -937,16 +893,27 @@ private void registerJobManagerRunnerTerminationFuture(
private CompletableFuture<Void> removeJob(JobID jobId, CleanupJobState
cleanupJobState) {
switch (cleanupJobState) {
case LOCAL:
- return localResourceCleaner.cleanupAsync(jobId);
+ return localCleanup(jobId);
case GLOBAL:
- return globalResourceCleaner
- .cleanupAsync(jobId)
- .thenRun(() -> markJobAsClean(jobId));
+ return globalCleanup(jobId).thenRun(() ->
markJobAsClean(jobId));
default:
throw new IllegalStateException("Invalid cleanup state: " +
cleanupJobState);
}
}
+ private CompletableFuture<Void> globalCleanup(JobID jobId) {
+ getMainThreadExecutor().assertRunningInMainThread();
Review comment:
Fair enough. I removed it also for `Dispatcher.localCleanup(JobID)`. I'm
just wondering whether it would be nicer to leave it there because it's a
requirement for the `DefaultResourceCleaner.cleanupAsync(JobID)` and having
that assert on the Dispatcher side makes it more explicit (for
`Dispatcher.globalCleanup(JobID)`, it's already explicit by providing the async
main thread `Executor` in `thenComposeAsync`.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]