Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YUNIKORN-2323] Gang scheduling user experience new events #876

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions pkg/cache/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,28 @@
dispatcher.Dispatch(ev)
}

// onResuming triggered when entering the resuming state which is triggered by the time out of the gang placeholders
// if SOFT gang scheduling is configured.
func (app *Application) onResuming() {
if app.originatingTask != nil {
events.GetRecorder().Eventf(app.originatingTask.GetTaskPod().DeepCopy(), nil, v1.EventTypeWarning, "GangScheduling",
"GangSchedulingFailed", "Application %s resuming as non-gang application (SOFT)", app.applicationID)
}
}

// onReserving triggered when entering the reserving state.
// During normal operation this creates all the placeholders. During recovery this call could cause the application
// in the shim and core to progress to the next state.
func (app *Application) onReserving() {
// happens after recovery - if placeholders already exist, we need to send
// if any placeholder already exist during recovery we might need to send
// an event to trigger Application state change in the core
if len(app.getPlaceHolderTasks()) > 0 {
ev := NewUpdateApplicationReservationEvent(app.applicationID)
dispatcher.Dispatch(ev)
} else if app.originatingTask != nil {
// not recovery or no placeholders created yet add an event to the pod
events.GetRecorder().Eventf(app.originatingTask.GetTaskPod().DeepCopy(), nil, v1.EventTypeNormal, "GangScheduling",
"CreatingPlaceholders", "Application %s creating placeholders", app.applicationID)

Check warning on line 519 in pkg/cache/application.go

View check run for this annotation

Codecov / codecov/patch

pkg/cache/application.go#L518-L519

Added lines #L518 - L519 were not covered by tests
}

go func() {
Expand All @@ -511,6 +527,11 @@
getPlaceholderManager().cleanUp(app)
ev := NewRunApplicationEvent(app.applicationID)
dispatcher.Dispatch(ev)
// failed at least one placeholder creation progress as a normal application
if app.originatingTask != nil {
events.GetRecorder().Eventf(app.originatingTask.GetTaskPod().DeepCopy(), nil, v1.EventTypeWarning, "GangScheduling",
"PlaceholderCreateFailed", "Application %s fall back to normal scheduling", app.applicationID)

Check warning on line 533 in pkg/cache/application.go

View check run for this annotation

Codecov / codecov/patch

pkg/cache/application.go#L531-L533

Added lines #L531 - L533 were not covered by tests
}
}
}()
}
Expand All @@ -520,7 +541,7 @@
func (app *Application) onReservationStateChange() {
if app.originatingTask != nil {
events.GetRecorder().Eventf(app.originatingTask.GetTaskPod().DeepCopy(), nil, v1.EventTypeNormal, "GangScheduling",
"Placeholder Allocated", "Application %s placeholder has been allocated.", app.applicationID)
"PlaceholderAllocated", "Application %s placeholder has been allocated.", app.applicationID)
}
desireCounts := make(map[string]int32, len(app.taskGroups))
for _, tg := range app.taskGroups {
Expand Down
4 changes: 4 additions & 0 deletions pkg/cache/application_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,10 @@ func newAppState() *fsm.FSM { //nolint:funlen
app := event.Args[0].(*Application) //nolint:errcheck
app.onReserving()
},
states.Resuming: func(_ context.Context, event *fsm.Event) {
app := event.Args[0].(*Application) //nolint:errcheck
app.onResuming()
},
SubmitApplication.String(): func(_ context.Context, event *fsm.Event) {
app := event.Args[0].(*Application) //nolint:errcheck
event.Err = app.handleSubmitApplicationEvent()
Expand Down
Loading