You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@yunikorn.apache.org by GitBox <gi...@apache.org> on 2022/01/15 06:59:22 UTC

[GitHub] [incubator-yunikorn-core] manirajv06 commented on a change in pull request #362: [YUNIKORN-958] Expose node utilisation info in new REST calls

manirajv06 commented on a change in pull request #362:
URL: https://github.com/apache/incubator-yunikorn-core/pull/362#discussion_r785279650



##########
File path: pkg/scheduler/objects/node.go
##########
@@ -239,6 +239,27 @@ func (sn *Node) GetAvailableResource() *resources.Resource {
 	return sn.availableResource.Clone()
 }
 
+// Get the utilized resource on this node.
+func (sn *Node) GetUtilizedResource() *resources.Resource {
+	total := sn.GetCapacity()
+	resourceAllocated := sn.GetAllocatedResource()
+	m := make(map[string]bool)
+	utilizedResource := make(map[string]resources.Quantity)
+
+	for name, v := range total.Resources {
+		if v > 0 {
+			m[name] = true
+		}
+	}

Review comment:
       Can we avoid this entire for loop and check each res value of "total" directly in below for loop?




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

To unsubscribe, e-mail: reviews-unsubscribe@yunikorn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org