pbacsko commented on code in PR #563:
URL: https://github.com/apache/yunikorn-core/pull/563#discussion_r1228218951


##########
pkg/scheduler/ugm/queue_tracker.go:
##########
@@ -115,6 +132,74 @@ func (qt *QueueTracker) decreaseTrackedResource(queuePath 
string, applicationID
        return removeQT, nil
 }
 
+func (qt *QueueTracker) setMaxApplications(count uint64, queuePath string) 
error {
+       log.Logger().Debug("Setting max applications",
+               zap.String("queue path", queuePath),
+               zap.Uint64("max applications", count))
+       var childQueuePath, immediateChildQueueName string
+       childQueuePath, immediateChildQueueName = getChildQueuePath(queuePath)
+       childQueueTracker := qt
+       if childQueuePath != "" {
+               for childQueuePath != "" {
+                       if childQueueTracker != nil {
+                               if len(childQueueTracker.childQueueTrackers) == 
0 || childQueueTracker.childQueueTrackers[immediateChildQueueName] == nil {
+                                       newChildQt := 
newQueueTracker(immediateChildQueueName)
+                                       
childQueueTracker.childQueueTrackers[immediateChildQueueName] = newChildQt
+                                       childQueueTracker = newChildQt
+                               } else {
+                                       childQueueTracker = 
childQueueTracker.childQueueTrackers[immediateChildQueueName]
+                               }
+                       }
+                       childQueuePath, immediateChildQueueName = 
getChildQueuePath(childQueuePath)
+               }
+       }
+
+       if int(childQueueTracker.maxRunningApps) != 0 && 
len(childQueueTracker.runningApplications) > int(count) {
+               log.Logger().Warn("Current running applications is greater than 
config max applications",
+                       zap.String("queue path", queuePath),
+                       zap.Int("current running applications", 
len(childQueueTracker.runningApplications)),
+                       zap.Uint64("config max applications", count))
+               return fmt.Errorf("current running applications is greater than 
config max applications for %s", queuePath)
+       } else {
+               childQueueTracker.maxRunningApps = count
+       }
+       return nil
+}
+
+func (qt *QueueTracker) setMaxResources(resource *resources.Resource, 
queuePath string) error {

Review Comment:
   I have a very strong deja vu... I'm pretty sure I've commented about 
`setMaxResources()` being very similar to `setMaxApplications()`... Was that a 
different PR? Anyway, here it is again! :)



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