zhuqi-lucas commented on code in PR #950:
URL: https://github.com/apache/yunikorn-core/pull/950#discussion_r1722960181


##########
pkg/scheduler/objects/queue.go:
##########
@@ -1609,20 +1612,38 @@ func (sq *Queue) updateMaxResourceMetrics() {
 
 // updateAllocatedResourceMetrics updates allocated resource metrics for all 
queue types.
 func (sq *Queue) updateAllocatedResourceMetrics() {
+       // Special case when we prune the allocated resources to zero, we need 
to update the metrics
+       // here only keep basic types memory and vcores to make sure we have 
updated metrics
+       if sq.allocatedResource.IsEmpty() {
+               
metrics.GetQueueMetrics(sq.QueuePath).SetQueueAllocatedResourceMetrics("memory",
 float64(0))
+               
metrics.GetQueueMetrics(sq.QueuePath).SetQueueAllocatedResourceMetrics("vcores",
 float64(0))
+       }

Review Comment:
   This is a better and clear solution @wilfred-s , addressed in latest PR.



##########
pkg/scheduler/objects/queue.go:
##########
@@ -1609,20 +1612,38 @@ func (sq *Queue) updateMaxResourceMetrics() {
 
 // updateAllocatedResourceMetrics updates allocated resource metrics for all 
queue types.
 func (sq *Queue) updateAllocatedResourceMetrics() {
+       // Special case when we prune the allocated resources to zero, we need 
to update the metrics
+       // here only keep basic types memory and vcores to make sure we have 
updated metrics
+       if sq.allocatedResource.IsEmpty() {
+               
metrics.GetQueueMetrics(sq.QueuePath).SetQueueAllocatedResourceMetrics("memory",
 float64(0))
+               
metrics.GetQueueMetrics(sq.QueuePath).SetQueueAllocatedResourceMetrics("vcores",
 float64(0))
+       }
        for k, v := range sq.allocatedResource.Resources {
                
metrics.GetQueueMetrics(sq.QueuePath).SetQueueAllocatedResourceMetrics(k, 
float64(v))
        }
 }
 
 // updatePendingResourceMetrics updates pending resource metrics for all queue 
types.
 func (sq *Queue) updatePendingResourceMetrics() {
+       // Special case when we prune the pending resources to zero, we need to 
update the metrics
+       // here only keep basic types memory and vcores to make sure we have 
updated metrics
+       if sq.pending.IsEmpty() {
+               
metrics.GetQueueMetrics(sq.QueuePath).SetQueuePendingResourceMetrics("memory", 
float64(0))
+               
metrics.GetQueueMetrics(sq.QueuePath).SetQueuePendingResourceMetrics("vcores", 
float64(0))
+       }
        for k, v := range sq.pending.Resources {
                
metrics.GetQueueMetrics(sq.QueuePath).SetQueuePendingResourceMetrics(k, 
float64(v))
        }
 }
 
 // updatePreemptingResourceMetrics updates preempting resource metrics for all 
queue types.
 func (sq *Queue) updatePreemptingResourceMetrics() {
+       // Special case when we prune the preempting resources to zero, we need 
to update the metrics
+       // here only keep basic types memory and vcores to make sure we have 
updated metrics
+       if sq.preemptingResource.IsEmpty() {
+               
metrics.GetQueueMetrics(sq.QueuePath).SetQueuePreemptingResourceMetrics("memory",
 float64(0))
+               
metrics.GetQueueMetrics(sq.QueuePath).SetQueuePreemptingResourceMetrics("vcores",
 float64(0))
+       }

Review Comment:
   Addressed in latest PR.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to