-
Notifications
You must be signed in to change notification settings - Fork 753
mcs/scheduling: register the scheduler handler in API service mode #7082
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
Changes from all commits
f625547
d9381ad
c71af4c
72e72b3
941f0bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -236,19 +236,24 @@ func (h *Handler) AddScheduler(name string, args ...string) error { | |
| return err | ||
| } | ||
| log.Info("create scheduler", zap.String("scheduler-name", s.GetName()), zap.Strings("scheduler-args", args)) | ||
| if !h.s.IsAPIServiceMode() { | ||
| if h.s.IsAPIServiceMode() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will we not need to forward create-scheduler and remove-scheduler requests to the scheduler server after this pr?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, the meta info should all be managed in the API server, and the scheduling service will watch them. |
||
| if err = c.AddSchedulerHandler(s, args...); err != nil { | ||
| log.Error("can not add scheduler handler", zap.String("scheduler-name", s.GetName()), zap.Strings("scheduler-args", args), errs.ZapError(err)) | ||
| return err | ||
| } | ||
| log.Info("add scheduler handler successfully", zap.String("scheduler-name", name), zap.Strings("scheduler-args", args)) | ||
| } else { | ||
| if err = c.AddScheduler(s, args...); err != nil { | ||
| log.Error("can not add scheduler", zap.String("scheduler-name", s.GetName()), zap.Strings("scheduler-args", args), errs.ZapError(err)) | ||
| return err | ||
| } | ||
| } else { | ||
| c.GetSchedulerConfig().AddSchedulerCfg(s.GetType(), args) | ||
| log.Info("add scheduler successfully", zap.String("scheduler-name", name), zap.Strings("scheduler-args", args)) | ||
| } | ||
| if err = h.opt.Persist(c.GetStorage()); err != nil { | ||
| log.Error("can not persist scheduler config", errs.ZapError(err)) | ||
| return err | ||
| } | ||
| log.Info("add scheduler successfully", zap.String("scheduler-name", name), zap.Strings("scheduler-args", args)) | ||
| log.Info("persist scheduler config successfully", zap.String("scheduler-name", name), zap.Strings("scheduler-args", args)) | ||
| return nil | ||
| } | ||
|
|
||
|
|
@@ -258,24 +263,18 @@ func (h *Handler) RemoveScheduler(name string) error { | |
| if err != nil { | ||
| return err | ||
| } | ||
| if !h.s.IsAPIServiceMode() { | ||
| if h.s.IsAPIServiceMode() { | ||
| if err = c.RemoveSchedulerHandler(name); err != nil { | ||
| log.Error("can not remove scheduler handler", zap.String("scheduler-name", name), errs.ZapError(err)) | ||
| } else { | ||
| log.Info("remove scheduler handler successfully", zap.String("scheduler-name", name)) | ||
| } | ||
| } else { | ||
| if err = c.RemoveScheduler(name); err != nil { | ||
| log.Error("can not remove scheduler", zap.String("scheduler-name", name), errs.ZapError(err)) | ||
| } else { | ||
| log.Info("remove scheduler successfully", zap.String("scheduler-name", name)) | ||
| } | ||
| } else { | ||
| conf := c.GetSchedulerConfig() | ||
| c.GetSchedulerConfig().RemoveSchedulerCfg(schedulers.FindSchedulerTypeByName(name)) | ||
| if err := conf.Persist(c.GetStorage()); err != nil { | ||
| log.Error("the option can not persist scheduler config", errs.ZapError(err)) | ||
| return err | ||
| } | ||
|
|
||
| if err := c.GetStorage().RemoveScheduleConfig(name); err != nil { | ||
| log.Error("can not remove the scheduler config", errs.ZapError(err)) | ||
| return err | ||
| } | ||
| } | ||
| return err | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.