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


##########
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:
   @pbacsko what i did is first find the parent recursively 
[method](https://github.com/apache/yunikorn-core/pull/429/files#diff-27632d48eb925e150a33bc92370ceaa66c31048018d11ca7a53a0b50ab7250acR1315
 ) 
   Then lock this parent sq only and incRunningApps. It's not single threaded. 
   This way we can avoid locking all the parents during the recursion. 
   I recall @wilfred-s pointed out this issue here 
https://github.com/apache/yunikorn-core/pull/384/files#r843616529 for combining 
into one method. 
   



##########
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:
   @pbacsko what i did is first find the parent recursively 
[code](https://github.com/apache/yunikorn-core/pull/429/files#diff-27632d48eb925e150a33bc92370ceaa66c31048018d11ca7a53a0b50ab7250acR1315
 ) 
   Then lock this parent sq only and incRunningApps. It's not single threaded. 
   This way we can avoid locking all the parents during the recursion. 
   I recall @wilfred-s pointed out this issue here 
https://github.com/apache/yunikorn-core/pull/384/files#r843616529 for combining 
into one method. 
   



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