pbacsko commented on a change in pull request #353:
URL: 
https://github.com/apache/incubator-yunikorn-core/pull/353#discussion_r781004297



##########
File path: pkg/scheduler/partition.go
##########
@@ -380,7 +406,33 @@ func (pc *PartitionContext) removeApplication(appID 
string) []*objects.Allocatio
        // Remove app from queue
        if queue := app.GetQueue(); queue != nil {
                queue.RemoveApplication(app)
+
+               var updateGroupMetrics bool
+               if len(app.GetUser().User) > 0 {
+                       user := 
queue.GetUserGroupManager().GetUser(app.GetUser().User)
+                       if user != nil {
+                               user.DecRunningApplications()
+                               g := 
queue.GetUserGroupManager().GetGroup(user.GetUsedGroup())
+                               if g != nil {
+                                       g.DecRunningApplications()
+                                       updateGroupMetrics = true
+                               }
+                       }
+               }
+
+               // Used when limit has been configured only for group, not for 
individual user
+               if ! updateGroupMetrics && len(app.GetUser().User) > 0 {
+                       for _, group := range app.GetUser().Groups {
+                               // Is there any group (to which user belongs 
to) config has limit settings?
+                               g := queue.GetUserGroupManager().GetGroup(group)
+                               if g != nil {
+                                       g.DecRunningApplications()
+                                       break

Review comment:
       From what I understand, that only works if `updateGroupMetrics = true`. 
Maybe I'm still not reading it correctly, but if "limit has been configured 
only for group, not for individual user" (as the comment says), then a modified 
list of groups will be checked against that saved value. So in my example, "qe" 
will not be part of if.




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