shuai-xu commented on a change in pull request #7227: [FLINK-11059] [runtime]
do not add releasing failed slot to free slots
URL: https://github.com/apache/flink/pull/7227#discussion_r293281070
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolTest.java
##########
@@ -770,6 +750,48 @@ public void
testFailingAllocationFailsPendingSlotRequests() throws Exception {
}
}
+ /**
+ * Tests that create snapshot of slots on a {@link TaskExecutor}.
+ */
+ @Test
+ public void testCreateSlotSnapshot() throws Exception {
+
+ try (SlotPoolImpl slotPool = new SlotPoolImpl(jobId)) {
+
+ final ArrayBlockingQueue<AllocationID> allocationIds =
new ArrayBlockingQueue<>(1);
+ resourceManagerGateway.setRequestSlotConsumer(
+ slotRequest ->
allocationIds.offer(slotRequest.getAllocationId()));
+
+ setupSlotPool(slotPool, resourceManagerGateway,
mainThreadExecutor);
+ Scheduler scheduler = setupScheduler(slotPool,
mainThreadExecutor);
+
+ final SlotRequestId slotRequestId = new SlotRequestId();
+ CompletableFuture<LogicalSlot> slotRequestFuture =
allocateSlot(scheduler, slotRequestId);
+
+ final List<OfferedSlot> offeredSlots = new
ArrayList<>(2);
+ final List<SlotOffer> slotOffers = new ArrayList<>(2);
+
+ AllocationID allocatedId = allocationIds.take();
+ slotOffers.add(new SlotOffer(allocatedId, 0,
ResourceProfile.UNKNOWN));
+ offeredSlots.add(new OfferedSlot(0, allocatedId));
+
+ AllocationID availableId = new AllocationID();
+ slotOffers.add(new SlotOffer(availableId, 1,
ResourceProfile.UNKNOWN));
+ offeredSlots.add(new OfferedSlot(1, availableId));
+
+
slotPool.registerTaskManager(taskManagerLocation.getResourceID());
+ slotPool.offerSlots(taskManagerLocation,
taskManagerGateway, slotOffers);
+
+ // wait for the completion of slot future
+ slotRequestFuture.get();
+
+ SlotSnapshot snapshot =
slotPool.createSlotSnapshot(taskManagerLocation.getResourceID());
+ assertEquals(jobId, snapshot.getJobId());
Review comment:
OK
----------------------------------------------------------------
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