XComp commented on a change in pull request #13547:
URL: https://github.com/apache/flink/pull/13547#discussion_r505381327



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
##########
@@ -1773,6 +1773,25 @@ public ResourceID getResourceID() {
                return unresolvedTaskManagerLocation.getResourceID();
        }
 
+       public long getUsedManagedMemory() {
+               Set<AllocationID> activeTaskAllocationIds = 
taskSlotTable.getActiveTaskSlotAllocationIds();
+
+               long usedMemory = 0L;
+               for (AllocationID allocationID : activeTaskAllocationIds) {
+                       try {
+                               usedMemory += 
taskSlotTable.getTaskMemoryManager(allocationID).usedMemory();
+                       } catch (SlotNotFoundException e) {
+                               log.debug("The task slot {} is not present 
anymore and will be ignore in calculating the amount of used memory.", 
e.getSlotID());

Review comment:
       Fair enough. I reverted the `SlotNotFoundException`. I introduced them 
for another version of the code which is not present anymore. I considered the 
`SlotNotFoundException` still an improvement. But you're right: We can still do 
such a change if it becomes really necessary.




----------------------------------------------------------------
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