Skip to content

Commit 4ea731f

Browse files
authored
logging cleanup of scheduler pkg (#1806)
Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com>
1 parent 83f3882 commit 4ea731f

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

pkg/epp/scheduling/framework/scheduler_profile.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,21 +128,21 @@ func (p *SchedulerProfile) Run(ctx context.Context, request *types.LLMRequest, c
128128
}
129129

130130
func (p *SchedulerProfile) runFilterPlugins(ctx context.Context, request *types.LLMRequest, cycleState *types.CycleState, pods []types.Pod) []types.Pod {
131-
loggerDebug := log.FromContext(ctx).V(logutil.DEBUG)
131+
logger := log.FromContext(ctx)
132132
filteredPods := pods
133-
loggerDebug.Info("Before running filter plugins", "pods", filteredPods)
133+
logger.V(logutil.DEBUG).Info("Before running filter plugins", "pods", filteredPods)
134134

135135
for _, filter := range p.filters {
136-
loggerDebug.Info("Running filter plugin", "plugin", filter.TypedName())
136+
logger.V(logutil.VERBOSE).Info("Running filter plugin", "plugin", filter.TypedName())
137137
before := time.Now()
138138
filteredPods = filter.Filter(ctx, cycleState, request, filteredPods)
139139
metrics.RecordPluginProcessingLatency(FilterExtensionPoint, filter.TypedName().Type, filter.TypedName().Name, time.Since(before))
140-
loggerDebug.Info("Completed running filter plugin successfully", "plugin", filter.TypedName(), "pods", filteredPods)
140+
logger.V(logutil.DEBUG).Info("Completed running filter plugin successfully", "plugin", filter.TypedName(), "pods", filteredPods)
141141
if len(filteredPods) == 0 {
142142
break
143143
}
144144
}
145-
loggerDebug.Info("Completed running filter plugins successfully")
145+
logger.V(logutil.VERBOSE).Info("Completed running filter plugins successfully")
146146

147147
return filteredPods
148148
}
@@ -157,7 +157,7 @@ func (p *SchedulerProfile) runScorerPlugins(ctx context.Context, request *types.
157157
}
158158
// Iterate through each scorer in the chain and accumulate the weighted scores.
159159
for _, scorer := range p.scorers {
160-
logger.V(logutil.DEBUG).Info("Running scorer plugin", "plugin", scorer.TypedName())
160+
logger.V(logutil.VERBOSE).Info("Running scorer plugin", "plugin", scorer.TypedName())
161161
before := time.Now()
162162
scores := scorer.Score(ctx, cycleState, request, pods)
163163
metrics.RecordPluginProcessingLatency(ScorerExtensionPoint, scorer.TypedName().Type, scorer.TypedName().Name, time.Since(before))
@@ -167,25 +167,25 @@ func (p *SchedulerProfile) runScorerPlugins(ctx context.Context, request *types.
167167
}
168168
logger.V(logutil.DEBUG).Info("Completed running scorer plugin successfully", "plugin", scorer.TypedName())
169169
}
170-
logger.V(logutil.DEBUG).Info("Completed running scorer plugins successfully")
170+
logger.V(logutil.VERBOSE).Info("Completed running scorer plugins successfully")
171171

172172
return weightedScorePerPod
173173
}
174174

175175
func (p *SchedulerProfile) runPickerPlugin(ctx context.Context, cycleState *types.CycleState, weightedScorePerPod map[types.Pod]float64) *types.ProfileRunResult {
176-
loggerDebug := log.FromContext(ctx).V(logutil.DEBUG)
176+
logger := log.FromContext(ctx)
177177
scoredPods := make([]*types.ScoredPod, len(weightedScorePerPod))
178178
i := 0
179179
for pod, score := range weightedScorePerPod {
180180
scoredPods[i] = &types.ScoredPod{Pod: pod, Score: score}
181181
i++
182182
}
183-
184-
loggerDebug.Info("Running picker plugin", "plugin", p.picker.TypedName(), "pods-weighted-score", weightedScorePerPod)
183+
logger.V(logutil.VERBOSE).Info("Running picker plugin", "plugin", p.picker.TypedName())
184+
logger.V(logutil.DEBUG).Info("Candidate pods for picking", "pods-weighted-score", scoredPods)
185185
before := time.Now()
186186
result := p.picker.Pick(ctx, cycleState, scoredPods)
187187
metrics.RecordPluginProcessingLatency(PickerExtensionPoint, p.picker.TypedName().Type, p.picker.TypedName().Name, time.Since(before))
188-
loggerDebug.Info("Completed running picker plugin successfully", "plugin", p.picker.TypedName(), "result", result)
188+
logger.V(logutil.DEBUG).Info("Completed running picker plugin successfully", "plugin", p.picker.TypedName(), "result", result)
189189

190190
return result
191191
}

pkg/epp/scheduling/scheduler.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ type Scheduler struct {
4545

4646
// Schedule finds the target pod based on metrics and the requested lora adapter.
4747
func (s *Scheduler) Schedule(ctx context.Context, request *types.LLMRequest, candidatePods []types.Pod) (*types.SchedulingResult, error) {
48-
logger := log.FromContext(ctx).WithValues("requestId", request.RequestId, "targetModel", request.TargetModel)
49-
loggerDebug := logger.V(logutil.DEBUG)
48+
loggerVerbose := log.FromContext(ctx).V(logutil.VERBOSE)
5049

5150
scheduleStart := time.Now()
5251
defer func() {
@@ -57,23 +56,23 @@ func (s *Scheduler) Schedule(ctx context.Context, request *types.LLMRequest, can
5756
cycleState := types.NewCycleState()
5857

5958
for { // get the next set of profiles to run iteratively based on the request and the previous execution results
60-
loggerDebug.Info("Running profile handler, Pick profiles", "plugin", s.profileHandler.TypedName())
59+
loggerVerbose.Info("Running profile handler, Pick profiles", "plugin", s.profileHandler.TypedName())
6160
before := time.Now()
6261
profiles := s.profileHandler.Pick(ctx, cycleState, request, s.profiles, profileRunResults)
6362
metrics.RecordPluginProcessingLatency(framework.ProfilePickerExtensionPoint, s.profileHandler.TypedName().Type, s.profileHandler.TypedName().Name, time.Since(before))
64-
loggerDebug.Info("Completed running profile handler Pick profiles successfully", "plugin", s.profileHandler.TypedName(), "result", profiles)
63+
loggerVerbose.Info("Completed running profile handler Pick profiles successfully", "plugin", s.profileHandler.TypedName(), "result", profiles)
6564
if len(profiles) == 0 { // profile picker didn't pick any profile to run
6665
break
6766
}
6867

6968
for name, profile := range profiles {
70-
loggerDebug.Info("Running scheduler profile", "name", name)
69+
loggerVerbose.Info("Running scheduler profile", "profile", name)
7170
// run the selected profiles and collect results (current code runs all profiles)
7271
profileRunResult, err := profile.Run(ctx, request, cycleState, candidatePods)
7372
if err != nil {
74-
loggerDebug.Info("failed to run scheduler profile", "profile", name, "error", err.Error())
73+
loggerVerbose.Info("failed to run scheduler profile", "profile", name, "error", err.Error())
7574
} else {
76-
loggerDebug.Info("Completed running scheduler profile succuessfully", "name", name)
75+
loggerVerbose.Info("Completed running scheduler profile succuessfully", "profile", name)
7776
}
7877

7978
profileRunResults[name] = profileRunResult // if profile failed to run, the run result is nil
@@ -84,11 +83,11 @@ func (s *Scheduler) Schedule(ctx context.Context, request *types.LLMRequest, can
8483
return nil, fmt.Errorf("failed to run any scheduler profile for request %s", request.RequestId)
8584
}
8685

87-
loggerDebug.Info("Running profile handler, ProcessResults", "plugin", s.profileHandler.TypedName())
86+
loggerVerbose.Info("Running profile handler, ProcessResults", "plugin", s.profileHandler.TypedName())
8887
before := time.Now()
8988
result, err := s.profileHandler.ProcessResults(ctx, cycleState, request, profileRunResults)
9089
metrics.RecordPluginProcessingLatency(framework.ProcessProfilesResultsExtensionPoint, s.profileHandler.TypedName().Type, s.profileHandler.TypedName().Name, time.Since(before))
91-
loggerDebug.Info("Completed running profile handler ProcessResults successfully", "plugin", s.profileHandler.TypedName())
90+
loggerVerbose.Info("Completed running profile handler ProcessResults successfully", "plugin", s.profileHandler.TypedName())
9291

9392
return result, err
9493
}

0 commit comments

Comments
 (0)