-
Notifications
You must be signed in to change notification settings - Fork 184
refactor scheduler filters package #797
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
refactor scheduler filters package #797
Conversation
✅ Deploy Preview for gateway-api-inference-extension ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
/assign |
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.
a few nits, will lgtm once #802 is merged
Thanks for the cleanup!
…y and maintainability Signed-off-by: Nir Rozenbaum <[email protected]>
Signed-off-by: Nir Rozenbaum <[email protected]>
3eaeeef to
eb5da45
Compare
| var defaultConfig = &SchedulerConfig{ | ||
| preSchedulePlugins: []plugins.PreSchedule{}, | ||
| filters: []plugins.Filter{&filter.SheddableRequestFilter{}, filter.LowLatencyFilter}, | ||
| scorers: map[plugins.Scorer]int{}, | ||
| picker: &picker.RandomPicker{}, | ||
| postSchedulePlugins: []plugins.PostSchedule{}, | ||
| } |
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.
after having some experience with setting a custom plugins, the recommended way would be to set in main.go the scheduler using NewSchedulerWithConfig.
no need for global var. default configuration is defined inside NewScheduler instead.
| // Filter filters out pods that doesn't meet the filter criteria. | ||
| func (f *HasCapacityFilter) Filter(ctx *types.SchedulingContext, pods []types.Pod) []types.Pod { | ||
| filteredPods := []types.Pod{} | ||
|
|
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'm reading this now again (reviewing myself lol).
@liu-cong does it make sense to get rid of Sheddable filter and put the following condition here at the beginning of the filter func?
if ctx.Req.Critical {
return pods
}sheddable filter doesn't do anything other than that..
anyway, if you agree with me, please let's defer to next PR since this is large enough and I don't want to include more changes unless it's a must.
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.
Yeah it makes sense to combine the two, perhaps call it HasCapacityForSheddableRequestFilter. Feel free to refactor or defer it.
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.
/lgtm
Thanks
| // Filter filters out pods that doesn't meet the filter criteria. | ||
| func (f *HasCapacityFilter) Filter(ctx *types.SchedulingContext, pods []types.Pod) []types.Pod { | ||
| filteredPods := []types.Pod{} | ||
|
|
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.
Yeah it makes sense to combine the two, perhaps call it HasCapacityForSheddableRequestFilter. Feel free to refactor or defer it.
|
/approve in case you want to address fusing the two filters into one |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahg-g, nirrozenbaum 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 |
|
/unhold |
|
/lgtm Great stuff! |
* refactor schdeuler filters package to simplify and improve readability and maintainability Signed-off-by: Nir Rozenbaum <[email protected]> * filter refactor finalizing Signed-off-by: Nir Rozenbaum <[email protected]> --------- Signed-off-by: Nir Rozenbaum <[email protected]>
* refactor schdeuler filters package to simplify and improve readability and maintainability Signed-off-by: Nir Rozenbaum <[email protected]> * filter refactor finalizing Signed-off-by: Nir Rozenbaum <[email protected]> --------- Signed-off-by: Nir Rozenbaum <[email protected]>
* refactor schdeuler filters package to simplify and improve readability and maintainability Signed-off-by: Nir Rozenbaum <[email protected]> * filter refactor finalizing Signed-off-by: Nir Rozenbaum <[email protected]> --------- Signed-off-by: Nir Rozenbaum <[email protected]>
This PR simplifies scheduler filters structuring in order to simplify, improve readability and maintainability, and align with best practices.
NO LOGIC CHANGE, only moving existing filters/logic to separate files.
the plugins that live in this repo should serve as an example for newcomers and adopters and as such, it's required to have the most simplified and aligned with best practices code.
not in scope of this PR:
handling of any scheduler package other than filter. any additional change will come in a separate PR.