Scheduler first fit (#123384)
* Don't evaluate extra nodes if there's no score plugin defined * Fix existing unit test (add no op scoring plugin) * Add unit tests for no score plugin scenario * address review comments * add a test with non-filter, non-scoring extender
This commit is contained in:

committed by
GitHub

parent
54bcbc3c75
commit
dd1e617ba0
@@ -93,6 +93,7 @@ func TestSchedulerWithExtenders(t *testing.T) {
|
||||
registerPlugins: []tf.RegisterPluginFunc{
|
||||
tf.RegisterFilterPlugin("TrueFilter", tf.NewTrueFilterPlugin),
|
||||
tf.RegisterQueueSortPlugin(queuesort.Name, queuesort.New),
|
||||
tf.RegisterScorePlugin("EqualPrioritizerPlugin", tf.NewEqualPrioritizerPlugin(), 1),
|
||||
tf.RegisterBindPlugin(defaultbinder.Name, defaultbinder.New),
|
||||
},
|
||||
extenders: []tf.FakeExtender{
|
||||
@@ -245,6 +246,7 @@ func TestSchedulerWithExtenders(t *testing.T) {
|
||||
// because of the errors from errorPredicateExtender.
|
||||
registerPlugins: []tf.RegisterPluginFunc{
|
||||
tf.RegisterFilterPlugin("TrueFilter", tf.NewTrueFilterPlugin),
|
||||
tf.RegisterScorePlugin("EqualPrioritizerPlugin", tf.NewEqualPrioritizerPlugin(), 1),
|
||||
tf.RegisterQueueSortPlugin(queuesort.Name, queuesort.New),
|
||||
tf.RegisterBindPlugin(defaultbinder.Name, defaultbinder.New),
|
||||
},
|
||||
@@ -268,6 +270,49 @@ func TestSchedulerWithExtenders(t *testing.T) {
|
||||
},
|
||||
name: "test 9",
|
||||
},
|
||||
{
|
||||
registerPlugins: []tf.RegisterPluginFunc{
|
||||
tf.RegisterFilterPlugin("TrueFilter", tf.NewTrueFilterPlugin),
|
||||
tf.RegisterQueueSortPlugin(queuesort.Name, queuesort.New),
|
||||
tf.RegisterBindPlugin(defaultbinder.Name, defaultbinder.New),
|
||||
},
|
||||
extenders: []tf.FakeExtender{
|
||||
{
|
||||
ExtenderName: "FakeExtender1",
|
||||
Predicates: []tf.FitPredicate{tf.TruePredicateExtender},
|
||||
},
|
||||
{
|
||||
ExtenderName: "FakeExtender2",
|
||||
Predicates: []tf.FitPredicate{tf.Node1PredicateExtender},
|
||||
},
|
||||
},
|
||||
nodes: []string{"node1", "node2"},
|
||||
expectedResult: ScheduleResult{
|
||||
SuggestedHost: "node1",
|
||||
EvaluatedNodes: 2,
|
||||
FeasibleNodes: 1,
|
||||
},
|
||||
name: "test 10 - no scoring, extender filters configured, multiple feasible nodes are evaluated",
|
||||
},
|
||||
{
|
||||
registerPlugins: []tf.RegisterPluginFunc{
|
||||
tf.RegisterQueueSortPlugin(queuesort.Name, queuesort.New),
|
||||
tf.RegisterBindPlugin(defaultbinder.Name, defaultbinder.New),
|
||||
},
|
||||
extenders: []tf.FakeExtender{
|
||||
{
|
||||
ExtenderName: "FakeExtender1",
|
||||
Binder: func() error { return nil },
|
||||
},
|
||||
},
|
||||
nodes: []string{"node1", "node2"},
|
||||
expectedResult: ScheduleResult{
|
||||
SuggestedHost: "node1",
|
||||
EvaluatedNodes: 1,
|
||||
FeasibleNodes: 1,
|
||||
},
|
||||
name: "test 11 - no scoring, no prefilters or extender filters configured, a single feasible node is evaluated",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
Reference in New Issue
Block a user