pbacsko commented on code in PR #900:
URL: https://github.com/apache/yunikorn-core/pull/900#discussion_r1657095522
##########
pkg/scheduler/objects/application_state.go:
##########
@@ -90,141 +90,149 @@ func (as applicationState) String() string {
return [...]string{"New", "Accepted", "Running", "Rejected",
"Completing", "Completed", "Failing", "Failed", "Expired", "Resuming"}[as]
}
+//nolint:funlen
+func eventDesc() fsm.Events {
+ return fsm.Events{
+ {
+ Name: RejectApplication.String(),
+ Src: []string{New.String()},
+ Dst: Rejected.String(),
+ },
+ {
+ Name: RunApplication.String(),
+ Src: []string{New.String(), Resuming.String()},
+ Dst: Accepted.String(),
+ },
+ {
+ Name: RunApplication.String(),
+ Src: []string{Accepted.String()},
+ Dst: Starting.String(),
+ },
+ {
+ Name: RunApplication.String(),
+ Src: []string{Running.String(), Starting.String(),
Completing.String()},
+ Dst: Running.String(),
+ },
+ {
+ Name: CompleteApplication.String(),
+ Src: []string{Accepted.String(), Running.String(),
Starting.String()},
+ Dst: Completing.String(),
+ },
+ {
+ Name: CompleteApplication.String(),
+ Src: []string{Completing.String()},
+ Dst: Completed.String(),
+ },
+ {
+ Name: FailApplication.String(),
+ Src: []string{New.String(), Accepted.String(),
Starting.String(), Running.String()},
+ Dst: Failing.String(),
+ },
+ {
+ Name: FailApplication.String(),
+ Src: []string{Failing.String()},
+ Dst: Failed.String(),
+ },
+ {
+ Name: ResumeApplication.String(),
+ Src: []string{New.String(), Accepted.String()},
+ Dst: Resuming.String(),
+ },
+ {
+ Name: ExpireApplication.String(),
+ Src: []string{Completed.String(), Failed.String(),
Rejected.String()},
+ Dst: Expired.String(),
+ },
+ }
+}
+
+func callbacks() fsm.Callbacks {
+ return fsm.Callbacks{
+ "enter_state": func(_ context.Context, event *fsm.Event) {
+ app := event.Args[0].(*Application) //nolint:errcheck
+ log.Logger().Info("Application state transition",
Review Comment:
I don't get it, what is this `log.Logger()` thing? This doesn't compile.
--
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]