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



##########
File path: pkg/scheduler/partition.go
##########
@@ -338,6 +338,32 @@ func (pc *PartitionContext) AddApplication(app 
*objects.Application) error {
                return fmt.Errorf("failed to find queue %s for application %s", 
queueName, appID)
        }
 
+       // Has user or group defined with any limits? If yes, Is there a room 
to operate?
+       user := queue.GetUserGroupManager().GetUser(app.GetUser().User)
+       if user != nil {
+               if user.CanRun() {
+                       user.IncRunningApplications()
+               } else {
+                       return fmt.Errorf("user '%s' has reached max 
applications limit in queue %s", app.GetUser().User,
+                               queueName)
+               }
+       }
+
+       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.CanRun() {
+                       g.IncRunningApplications()
+                       if user != nil {
+                               user.SetUsedGroup(g.GetName())

Review comment:
       Yes, a user may belong to more than group. Added user.SetUsedGroup() 
mainly to reduce this kind of friction by storing the group and use the same in 
future as well. As and when configured group arrives while traversing groups of 
user, that group would be picked up and set. Also, setting group using 
user.SetUsedGroup() avoids parsing groups again while removing the application 
to larger extent.




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