vthinkxie commented on a change in pull request #15249:
URL: https://github.com/apache/flink/pull/15249#discussion_r597360427



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/FineGrainedSlotManager.java
##########
@@ -636,6 +637,15 @@ public ResourceProfile getFreeResourceOf(InstanceID 
instanceID) {
         return taskManagerTracker.getRegisteredResourceOf(instanceID);
     }
 
+    @Override
+    public Collection<SlotInfo> getAllocatedSlotsOf(InstanceID instanceID) {
+        return taskManagerTracker.getRegisteredTaskManager(instanceID)
+                .map(TaskManagerInfo::getAllocatedSlots).map(Map::values)
+                .orElse(Collections.emptyList()).stream()
+                .map(slot -> new SlotInfo(slot.getJobId(), 
slot.getResourceProfile()))
+                .collect(Collectors.toList());

Review comment:
       "Job as has N slots on TM Z, where slot 1 uses X_1 memory any Y_1 cpus, 
and slot 2 uses X_2 memory and Y_2 cpus, and ..." could be aggregated and get 
"Job A has allocated X memory and Y CPUs on TM Z to run N tasks."
   while it cannot be pushed backward.
   Since TM and resources are implemented on a slots basis, the interface layer 
should expose atomic properties




-- 
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:
us...@infra.apache.org


Reply via email to