You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@yunikorn.apache.org by GitBox <gi...@apache.org> on 2022/11/19 00:37:41 UTC

[GitHub] [yunikorn-core] lixmgl commented on a diff in pull request #429: [YUNIKORN-790] Implement MaxApplications enforcement

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


##########
pkg/scheduler/objects/queue.go:
##########
@@ -1292,3 +1304,67 @@ 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.internalIncRunningApps()
+}
+
+func (sq *Queue) internalIncRunningApps() {
+	sq.Lock()
+	defer sq.Unlock()
+	sq.runningApps++
+}

Review Comment:
   @craigcondit Thanks for the info, it make sense.
   I updated by merging them into one method. Please review. 



##########
pkg/scheduler/objects/queue.go:
##########
@@ -1292,3 +1304,67 @@ 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.internalIncRunningApps()
+}
+
+func (sq *Queue) internalIncRunningApps() {
+	sq.Lock()
+	defer sq.Unlock()
+	sq.runningApps++
+}
+
+func (sq *Queue) decRunningApps() {
+	if sq == nil {
+		return
+	}
+	if sq.parent != nil {
+		sq.parent.decRunningApps()
+	}
+	sq.internalDecRunningApps()
+}
+
+func (sq *Queue) internalDecRunningApps() {
+	sq.Lock()
+	defer sq.Unlock()
+	sq.runningApps--
+}

Review Comment:
   Updated. 



-- 
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: reviews-unsubscribe@yunikorn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org