New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eliminate running paths of Predicates in scheduler #86133
Eliminate running paths of Predicates in scheduler #86133
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thanks! a couple of nits.
@@ -555,6 +554,7 @@ func (g *genericScheduler) findNodesThatFit(ctx context.Context, state *framewor | |||
if !extender.IsInterested(pod) { | |||
continue | |||
} | |||
// TODO(Huang-Wei): refactor the signature of extender Filter() and have it UTed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to change the signature of filter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's extender's Filter(), not the generic framework.Filter():
kubernetes/pkg/scheduler/algorithm/scheduler_interface.go
Lines 35 to 37 in a8caae5
Filter(pod *v1.Pod, | |
nodes []*v1.Node, nodeNameToInfo map[string]*schedulernodeinfo.NodeInfo, | |
) (filteredNodes []*v1.Node, failedNodesMap extenderv1.FailedNodesMap, err error) |
It should be adherent with:
Filter(ctx context.Context, state *CycleState, pod *v1.Pod, nodeInfo *schedulernodeinfo.NodeInfo) *Status |
Am I correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, we will call the extender with all filtered nodes (make a single call, not one per node), otherwise it will be very expensive. Also, this is a v1 API, good luck changing that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol... Let me see how it goes.
"1": []algorithmpredicates.PredicateFailureReason{algorithmpredicates.ErrFakePredicate, algorithmpredicates.ErrFakePredicate}, | ||
}, | ||
FilteredNodesStatuses: framework.NodeToStatusMap{}, | ||
// TODO(Huang-Wei): remove this when 'alwaysCheckAllPredicates' gets removed from API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it now? alwaysCheckAllPredicates does not have an impact now anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SG.
type RegisterFilterPluginFunc func(reg *framework.Registry, plugins *schedulerapi.Plugins, pluginConfigs []schedulerapi.PluginConfig) | ||
|
||
// RegisterFilterPlugin returns a function to register a Filter Plugin to a given registry. | ||
func RegisterFilterPlugin(pluginName string, pluginNewFunc framework.PluginFactory) RegisterFilterPluginFunc { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe those two functions will be used anywhere other than unit tests, and they are not quite related to migration because they will live beyond migration, right? if yes, how about we put those in scheduler/testing/framework_helpers.go
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. Sounds fair to move to testing
package.
The integration test failure is a real one. Fixing... |
stateToUse := state | ||
nodeInfoToUse := info | ||
if i == 0 { | ||
var err error | ||
podsAdded, metaToUse, stateToUse, nodeInfoToUse, err = g.addNominatedPods(ctx, pod, meta, state, info) | ||
podsAdded, _, stateToUse, nodeInfoToUse, err = g.addNominatedPods(ctx, pod, meta, state, info) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this is the only usage of addNominatedPods
. Remove the return value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get rid of it in the metadata cleanup PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sg, TODO maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeap, added at L587:
// TODO(Huang-Wei): remove 'meta predicates.Metadata' from the signature.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Huang-Wei The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold |
plugins.Filter.Enabled = append(plugins.Filter.Enabled, schedulerapi.Plugin{Name: pluginName}) | ||
//lint:ignore SA4006 this value of pluginConfigs is never used. | ||
//lint:ignore SA4010 this result of append is never used. | ||
pluginConfigs = append(pluginConfigs, schedulerapi.PluginConfig{Name: pluginName}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need these two comments to disable lints here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the single line reports two violations..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems wierd...
/retest |
Great! can you please squash. |
- eliminate running paths of Predicates in scheduler; use Filter Plugins instead. - refactor all unit tests - adjust the TestPreemptWithPermitPlugin integration test
24b1eaa
to
dc3d1bd
Compare
/hold cancel |
/lgtm |
What type of PR is this?
/kind cleanup
/sig scheduling
What this PR does / why we need it:
Which issue(s) this PR fixes:
Part of #85918.
Special notes for your reviewer:
Some TODOs will be covered in the next PR.
Does this PR introduce a user-facing change?:
/cc @ahg-g @alculquicondor @damemi @ravisantoshgudimetla @draveness