yangwwei commented on a change in pull request #203:
URL:
https://github.com/apache/incubator-yunikorn-k8shim/pull/203#discussion_r514614533
##########
File path: pkg/cache/application.go
##########
@@ -359,6 +402,50 @@ func (app *Application)
handleRecoverApplicationEvent(event *fsm.Event) {
}
}
+func (app *Application) postAppAccepted(event *fsm.Event) {
+ // if app has taskGroups defined, it goes to the Reserving state before
getting to Running
+ var ev events.SchedulingEvent
+ if app.taskGroups != nil {
+ ev = NewSimpleApplicationEvent(app.applicationID,
events.TryReserve)
+ dispatcher.Dispatch(ev)
+ } else {
+ ev = NewRunApplicationEvent(app.applicationID)
+ }
+ dispatcher.Dispatch(ev)
+}
+
+func (app *Application) onReserving(event *fsm.Event) {
+ go func() {
+ // while doing reserving
+ if err := GetPlaceholderManager().createAppPlaceholders(app);
err != nil {
+ // creating placeholder failed
+ // put the app into recycling queue and turn the app to
running state
+ GetPlaceholderManager().Recycle(app.applicationID)
+ ev := NewRunApplicationEvent(app.applicationID)
Review comment:
If the placeholder creation failed, that means something goes wrong on
the cluster. An error handling for this scenario is to delete all existing
placeholders and move the app to the next stage. In the Running state, we run
app's normal pods, try to schedule them without creating any placeholders. This
way, we won't be **stuck** at the Reserving state forever, which is wasting
cluster resources.
A possible improvement for this is to do some **retry** while creating
placeholders. Retries for some time before completely giving up.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]