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



##########
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:
       This is related to my comment above. If we our pick from multiple groups 
is deterministic, then it's fine. Otherwise we have to think about how to 
handle the multiple group case (I don't know how common that is, but 
`usergroup.UserGroup` is `string[]`, so at least it has theoretical 
possibility).




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