From a3df614b0b5a6b40ec6fab5837869fa6b4335725 Mon Sep 17 00:00:00 2001 From: Xuzheng Chang Date: Wed, 31 Aug 2022 18:46:25 +0800 Subject: [PATCH] add action/plugin registration and loading log Signed-off-by: Xuzheng Chang --- pkg/scheduler/framework/plugins.go | 2 ++ pkg/scheduler/scheduler.go | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/pkg/scheduler/framework/plugins.go b/pkg/scheduler/framework/plugins.go index bcf2d76558..7880c0e100 100644 --- a/pkg/scheduler/framework/plugins.go +++ b/pkg/scheduler/framework/plugins.go @@ -40,6 +40,7 @@ func RegisterPluginBuilder(name string, pc PluginBuilder) { defer pluginMutex.Unlock() pluginBuilders[name] = pc + klog.V(2).Infof("Successfully registered plugin: %s", name) } // CleanupPluginBuilders cleans up all the plugin @@ -107,6 +108,7 @@ func RegisterAction(act Action) { defer pluginMutex.Unlock() actionMap[act.Name()] = act + klog.V(2).Infof("Successfully registered action: %s", act.Name()) } // GetAction get the action by name diff --git a/pkg/scheduler/scheduler.go b/pkg/scheduler/scheduler.go index 4fb751da2d..aeba986c8c 100644 --- a/pkg/scheduler/scheduler.go +++ b/pkg/scheduler/scheduler.go @@ -121,6 +121,11 @@ func (pc *Scheduler) runOnce() { func (pc *Scheduler) loadSchedulerConf() { klog.V(4).Infof("Start loadSchedulerConf ...") + defer func() { + actions, plugins := pc.getSchedulerConf() + klog.V(4).Infof("Successfully loaded scheduler conf, actions: %v, plugins: %v", actions, plugins) + }() + var err error pc.once.Do(func() { pc.actions, pc.plugins, pc.configurations, pc.metricsConf, err = unmarshalSchedulerConf(defaultSchedulerConf) @@ -154,6 +159,18 @@ func (pc *Scheduler) loadSchedulerConf() { pc.mutex.Unlock() } +func (pc *Scheduler) getSchedulerConf() (actions []string, plugins []string) { + for _, action := range pc.actions { + actions = append(actions, action.Name()) + } + for _, tier := range pc.plugins { + for _, plugin := range tier.Plugins { + plugins = append(plugins, plugin.Name) + } + } + return +} + func (pc *Scheduler) watchSchedulerConf(stopCh <-chan struct{}) { if pc.fileWatcher == nil { return