Skip to content

Commit 24fe5a2

Browse files
committed
Moved RunPreScorePlugins to inside prioritizeNodes and RunPreFilterPlugins to inside findNodesThatFitPod.
1 parent f9b650b commit 24fe5a2

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
@@ -167,12 +167,6 @@ func (g *genericScheduler) Schedule(ctx context.Context, prof *profile.Profile,
167167

168168
// Run "prefilter" plugins.
169169
startPredicateEvalTime := time.Now()
170-
preFilterStatus := prof.RunPreFilterPlugins(ctx, state, pod)
171-
if !preFilterStatus.IsSuccess() {
172-
return result, preFilterStatus.AsError()
173-
}
174-
trace.Step("Running prefilter plugins done")
175-
176170
filteredNodes, filteredNodesStatuses, err := g.findNodesThatFitPod(ctx, prof, state, pod)
177171
if err != nil {
178172
return result, err
@@ -201,13 +195,6 @@ func (g *genericScheduler) Schedule(ctx context.Context, prof *profile.Profile,
201195
}, nil
202196
}
203197

204-
// Run "prescore" plugins.
205-
prescoreStatus := prof.RunPreScorePlugins(ctx, state, pod, filteredNodes)
206-
if !prescoreStatus.IsSuccess() {
207-
return result, prescoreStatus.AsError()
208-
}
209-
trace.Step("Running prescore plugins done")
210-
211198
priorityList, err := g.prioritizeNodes(ctx, prof, state, pod, filteredNodes)
212199
if err != nil {
213200
return result, err
@@ -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)