tillrohrmann commented on a change in pull request #7568: [FLINK-11417] Make 
access to ExecutionGraph single threaded from JobMaster main thread
URL: https://github.com/apache/flink/pull/7568#discussion_r250617749
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/Execution.java
 ##########
 @@ -508,8 +523,13 @@ public void setInitialState(@Nullable 
JobManagerTaskRestore taskRestore) {
 
                        final SlotRequestId slotRequestId = new SlotRequestId();
 
-                       final CompletableFuture<LogicalSlot> logicalSlotFuture 
= preferredLocationsFuture
-                               .thenCompose(
+                       final ComponentMainThreadExecutor mainThreadExecutor =
+                               
vertex.getExecutionGraph().getJobMasterMainThreadExecutor();
+
+                       final CompletableFuture<LogicalSlot> logicalSlotFuture =
+                               FutureUtils.composeAsyncIfNotDone(
+                                       preferredLocationsFuture,
+                                       mainThreadExecutor,
 
 Review comment:
   Instead of adding everywhere the `mainThreadExecutor` couldn't we also 
guarantee that `slotProvider.allocateSlot` returns a future which is completed 
by the main thread? I think the easiest way would be to use `handleAsync`. With 
that you also break the exceptional case and can reassign the executing thread. 
E.g. we could wrap `slotProvider` or call `slotProvider.thenHandleAsync`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

Reply via email to