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_r252256128
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionGraphSchedulingTest.java
##########
@@ -544,55 +556,62 @@ public void testCancellationOfIncompleteScheduling()
throws Exception {
final ExecutionGraph executionGraph =
createExecutionGraph(jobGraph, slotProvider);
- executionGraph.scheduleForExecution();
-
- // wait until we have requested all slots
- requestedSlotsLatch.await();
-
+ executionGraph.start(testMainThread.getMainThreadExecutor());
final Set<SlotRequestId> slotRequestIdsToReturn =
ConcurrentHashMap.newKeySet(slotRequestIds.size());
- slotRequestIdsToReturn.addAll(slotRequestIds.keySet());
final CountDownLatch countDownLatch = new
CountDownLatch(slotRequestIds.size());
- slotOwner.setReturnAllocatedSlotConsumer(logicalSlot -> {
-
slotRequestIdsToReturn.remove(logicalSlot.getSlotRequestId());
- countDownLatch.countDown();
- });
- slotProvider.setSlotCanceller(slotRequestId -> {
- slotRequestIdsToReturn.remove(slotRequestId);
- countDownLatch.countDown();
- });
+ testMainThread.execute(() -> {
Review comment:
I think we could avoid having to use the `testMainThread` here if we make
the test deterministic. For example, we could instantiate the
`TestingSlotProvider` with a set of completed futures and uncompleted futures.
This would simulate that some of the `Executions` will be in state `DEPLOYING`
and others in `SCHEDULING`. Then we call `eg.cancel` and check that all slot
are being returned and the unfulfilled futures are canceled. Moreover, we check
that if we fulfill a future after the cancellation, it will automatically be
released by the failure handler in `Execution.java:568`
----------------------------------------------------------------
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