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



##########
File path: pkg/scheduler/partition.go
##########
@@ -338,6 +338,50 @@ func (pc *PartitionContext) AddApplication(app 
*objects.Application) error {
                return fmt.Errorf("failed to find queue %s for application %s", 
queueName, appID)
        }
 
+       if app.GetUser().User != "" {
+               // Has user limit configured with "*" ?
+               user := queue.GetUserGroupManager().GetUser(app.GetUser().User)
+               if queue.GetUserGroupManager().IsAllUserAllowed() && user == 
nil {
+                       user = objects.NewUser(app.GetUser().User)
+                       
user.SetMaxApplications(queue.GetUserGroupManager().GetUser(objects.AllUser).GetMaxApplications())
+                       queue.GetUserGroupManager().AddUserIfAbsent(user)
+               }
+
+               // 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 && user.IsMaxAppsLimitSet() {
+                       if user.IsRunningAppsUnderLimit() {
+                               user.IncRunningApplications()

Review comment:
       I wanted to confirm if this approach is problematic or not and 
unfortunately, it seems to be the case.
   See this small code: https://go.dev/play/p/9sYzZindXO5
   
   This uses code fragments from this PR. The counter might overrun and end up 
being 31.
   
   If you insist on using atomics, this solution seems to do the job: 
https://go.dev/play/p/DeDVAuhDlxG




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