xintongsong commented on a change in pull request #9928: [FLINK-12122] Add
support for spreading slots out across all TaskExecutors
URL: https://github.com/apache/flink/pull/9928#discussion_r336418846
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotSharingManager.java
##########
@@ -185,18 +186,55 @@ MultiTaskSlot createRootSlot(
return resolvedRootSlots
.values()
.stream()
- .flatMap((Map<AllocationID, MultiTaskSlot> map)
-> map.values().stream())
-
.filter(validMultiTaskSlotAndDoesNotContain(groupId))
- .map((MultiTaskSlot multiTaskSlot) -> {
- SlotInfo slotInfo =
multiTaskSlot.getSlotContextFuture().join();
+ .flatMap((Map<AllocationID, MultiTaskSlot> map)
-> filterUsedAndReleasingMultiTaskSlots(map, groupId))
+ .map((MultiTaskSlotInfo multiTaskSlotInfo) -> {
+ SlotInfo slotInfo =
multiTaskSlotInfo.getSlotInfo();
return new
SlotSelectionStrategy.SlotInfoAndResources(
- slotInfo,
-
slotInfo.getResourceProfile().subtract(multiTaskSlot.getReservedResources()));
+ slotInfo,
+
slotInfo.getResourceProfile().subtract(multiTaskSlotInfo.getReservedResources()),
+
multiTaskSlotInfo.getTaskExecutorUtilization());
}).collect(Collectors.toList());
}
+ private Stream<MultiTaskSlotInfo>
filterUsedAndReleasingMultiTaskSlots(Map<AllocationID, MultiTaskSlot>
taskExecutorSlots, AbstractID groupId) {
Review comment:
Suggest to name this method `streamFliterUsedAndReleasingMultiTaskSlots` or
`filterUsedAndReleasingMultiTaskSlotsStream`.
The original name is a bit confusing because it actually does more then
filtering (but also streaming/flatMapping), which makes the logics in
`listResolvedRootSlotInfo` not easy to understand.
----------------------------------------------------------------
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