Skip to content

Commit a81214f

Browse files
authored
added scheduler config logging on bootstrap (#1247)
Signed-off-by: Nir Rozenbaum <[email protected]>
1 parent 5a17f51 commit a81214f

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

cmd/epp/runner/runner.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ func (r *Runner) Run(ctx context.Context) error {
317317
setupLog.Error(err, "failed to create scheduler")
318318
return err
319319
}
320+
321+
setupLog.Info("parsed config", "scheduler-config", r.schedulerConfig)
322+
320323
scheduler := scheduling.NewSchedulerWithConfig(r.schedulerConfig)
321324

322325
saturationDetector := saturationdetector.NewDetector(sdConfig, datastore, setupLog)
@@ -404,8 +407,6 @@ func (r *Runner) parsePluginsConfiguration(ctx context.Context) error {
404407
return fmt.Errorf("failed to load the configuration - %w", err)
405408
}
406409

407-
setupLog.Info("Configuration file loaded", "config", config)
408-
409410
r.schedulerConfig, err = loader.LoadSchedulerConfig(config.SchedulingProfiles, handle)
410411
if err != nil {
411412
return fmt.Errorf("failed to create Scheduler configuration - %w", err)

pkg/epp/scheduling/framework/scheduler_profile.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package framework
1919
import (
2020
"context"
2121
"fmt"
22+
"strings"
2223
"time"
2324

2425
"sigs.k8s.io/controller-runtime/pkg/log"
@@ -105,6 +106,28 @@ func (p *SchedulerProfile) AddPlugins(pluginObjects ...plugins.Plugin) error {
105106
return nil
106107
}
107108

109+
func (p *SchedulerProfile) String() string {
110+
filterNames := make([]string, len(p.filters))
111+
for i, filter := range p.filters {
112+
filterNames[i] = filter.TypedName().String()
113+
}
114+
scorerNames := make([]string, len(p.scorers))
115+
for i, scorer := range p.scorers {
116+
scorerNames[i] = fmt.Sprintf("%s: %d", scorer.TypedName(), scorer.Weight())
117+
}
118+
postCyclePluginNames := make([]string, len(p.postCyclePlugins))
119+
for i, postCyclePlugin := range p.postCyclePlugins {
120+
postCyclePluginNames[i] = postCyclePlugin.TypedName().String()
121+
}
122+
return fmt.Sprintf(
123+
"{Filters: [%s], Scorers: [%s], Picker: %s, PostCyclePlugins: [%s]}",
124+
strings.Join(filterNames, ", "),
125+
strings.Join(scorerNames, ", "),
126+
p.picker.TypedName(),
127+
strings.Join(postCyclePluginNames, ", "),
128+
)
129+
}
130+
108131
// RunCycle runs a SchedulerProfile cycle. In other words, it invokes all the SchedulerProfile plugins in this
109132
// order - Filters, Scorers, Picker, PostCyclePlugins. After completing all, it returns the result.
110133
func (p *SchedulerProfile) Run(ctx context.Context, request *types.LLMRequest, cycleState *types.CycleState, candidatePods []types.Pod) (*types.ProfileRunResult, error) {

pkg/epp/scheduling/scheduler_config.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package scheduling
1818

1919
import (
20+
"fmt"
21+
2022
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework"
2123
)
2224

@@ -33,3 +35,11 @@ type SchedulerConfig struct {
3335
profileHandler framework.ProfileHandler
3436
profiles map[string]*framework.SchedulerProfile
3537
}
38+
39+
func (c *SchedulerConfig) String() string {
40+
return fmt.Sprintf(
41+
"{ProfileHandler: %s, Profiles: %v}",
42+
c.profileHandler.TypedName(),
43+
c.profiles,
44+
)
45+
}

0 commit comments

Comments
 (0)