Skip to content

Commit 62108be

Browse files
authored
Merge pull request kubernetes#89370 from ahg-g/ahg-prescore
Execute PreScore right before Score instead of after Filter.
2 parents 4738ba5 + 24fe5a2 commit 62108be

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

pkg/scheduler/core/generic_scheduler.go

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,6 @@ func (g *genericScheduler) Schedule(ctx context.Context, prof *profile.Profile,
166166
}
167167

168168
// Run "prefilter" plugins.
169-
preFilterStatus := prof.RunPreFilterPlugins(ctx, state, pod)
170-
if !preFilterStatus.IsSuccess() {
171-
return result, preFilterStatus.AsError()
172-
}
173-
trace.Step("Running prefilter plugins done")
174-
175169
startPredicateEvalTime := time.Now()
176170
filteredNodes, filteredNodesStatuses, err := g.findNodesThatFitPod(ctx, prof, state, pod)
177171
if err != nil {
@@ -187,13 +181,6 @@ func (g *genericScheduler) Schedule(ctx context.Context, prof *profile.Profile,
187181
}
188182
}
189183

190-
// Run "prescore" plugins.
191-
prescoreStatus := prof.RunPreScorePlugins(ctx, state, pod, filteredNodes)
192-
if !prescoreStatus.IsSuccess() {
193-
return result, prescoreStatus.AsError()
194-
}
195-
trace.Step("Running prescore plugins done")
196-
197184
metrics.DeprecatedSchedulingAlgorithmPredicateEvaluationSecondsDuration.Observe(metrics.SinceInSeconds(startPredicateEvalTime))
198185
metrics.DeprecatedSchedulingDuration.WithLabelValues(metrics.PredicateEvaluation).Observe(metrics.SinceInSeconds(startPredicateEvalTime))
199186

@@ -412,6 +399,11 @@ func (g *genericScheduler) numFeasibleNodesToFind(numAllNodes int32) (numNodes i
412399
// Filters the nodes to find the ones that fit the pod based on the framework
413400
// filter plugins and filter extenders.
414401
func (g *genericScheduler) findNodesThatFitPod(ctx context.Context, prof *profile.Profile, state *framework.CycleState, pod *v1.Pod) ([]*v1.Node, framework.NodeToStatusMap, error) {
402+
s := prof.RunPreFilterPlugins(ctx, state, pod)
403+
if !s.IsSuccess() {
404+
return nil, nil, s.AsError()
405+
}
406+
415407
filteredNodesStatuses := make(framework.NodeToStatusMap)
416408
filtered, err := g.findNodesThatPassFilters(ctx, prof, state, pod, filteredNodesStatuses)
417409
if err != nil {
@@ -643,10 +635,16 @@ func (g *genericScheduler) prioritizeNodes(
643635
return result, nil
644636
}
645637

638+
// Run PreScore plugins.
639+
preScoreStatus := prof.RunPreScorePlugins(ctx, state, pod, nodes)
640+
if !preScoreStatus.IsSuccess() {
641+
return nil, preScoreStatus.AsError()
642+
}
643+
646644
// Run the Score plugins.
647645
scoresMap, scoreStatus := prof.RunScorePlugins(ctx, state, pod, nodes)
648646
if !scoreStatus.IsSuccess() {
649-
return framework.NodeScoreList{}, scoreStatus.AsError()
647+
return nil, scoreStatus.AsError()
650648
}
651649

652650
// Summarize all scores.

0 commit comments

Comments
 (0)