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



##########
File path: pkg/scheduler/objects/application_state.go
##########
@@ -171,6 +175,9 @@ func NewAppState() *fsm.FSM {
                        },
                        fmt.Sprintf("leave_%s", Running.String()): func(event 
*fsm.Event) {
                                app := event.Args[0].(*Application) 
//nolint:errcheck
+                               if app.queue != nil {
+                                       app.queue.runningApps--

Review comment:
       At this point, we have to update the pending applications and start the 
one which was blocked first.
   
   Just a very POC-like code:
   ```
   pendingApps []*Applications
   ...
           // TODO: not optimal, a SubmissionTime-based min-Heap is better
        sort.Slice(pendingApps, func(i, j int) bool {
                if 
pendingApps[i].SubmissionTime.Before(pendingApps[j].SubmissionTime) {
                        return true
                }
                return false
        })
   
        selected := pendingApps[0]
        selected.stateMachine.Event(RunApplication.String(), selected) // 
trigger app to run
   ...
   ```
   
   This is really just a rough idea, need to be tested thoroughly.




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