craigcondit commented on code in PR #429:
URL: https://github.com/apache/yunikorn-core/pull/429#discussion_r1028296754


##########
pkg/scheduler/objects/queue.go:
##########
@@ -1292,3 +1306,71 @@ func (sq *Queue) String() string {
        return fmt.Sprintf("{QueuePath: %s, State: %s, StateTime: %x, 
MaxResource: %s}",
                sq.QueuePath, sq.stateMachine.Current(), sq.stateTime, 
sq.maxResource)
 }
+
+func (sq *Queue) incRunningApps() {
+       if sq == nil {
+               return
+       }
+       if sq.parent != nil {
+               sq.parent.incRunningApps()
+       }
+       sq.Lock()
+       defer sq.Unlock()
+       sq.runningApps++
+}
+
+func (sq *Queue) decRunningApps() {
+       if sq == nil {
+               return
+       }
+       if sq.parent != nil {
+               sq.parent.decRunningApps()
+       }
+       sq.Lock()
+       defer sq.Unlock()
+       sq.runningApps--
+}
+
+func (sq *Queue) incAllocatingAcceptedAppsIfCanRun(sa *Application) bool {
+       if sq == nil {
+               return false
+       }
+       success := true
+       if sq.parent != nil {
+               success = sq.parent.incAllocatingAcceptedAppsIfCanRun(sa)
+       }
+       return sq.InternalIncAllocatingAcceptedAppsIfCanRun(success, sa)
+}
+
+func (sq *Queue) InternalIncAllocatingAcceptedAppsIfCanRun(success bool, sa 
*Application) bool {

Review Comment:
   This can be combined into incAllocatingAppsIfCanRun() as well, since it is a 
tail call. I think that improves the visibility.



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