Skip to content

added scheduler plugins interfaces to initialize scheduler refactoring #721

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

Closed

Conversation

nirrozenbaum
Copy link
Contributor

after several maintainers reviewed @liu-cong PR #677, it was decided to break down that PR into smaller PRs to allow easier reviews and refactoring.

This PR is a first out of a series of PRs that will result in the scheduler refactoring according to the description in #677.
Current PR defines the scheduler new plugins interfaces and does the minimal changes to adapt the existing code to use the new Filter interface.

In a follow up PR, the scheduler will be updated to use these interfaces in its Schedule function.

Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 21, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: nirrozenbaum
Once this PR has been reviewed and has the lgtm label, please assign ahg-g for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested review from ahg-g and robscott April 21, 2025 21:06
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 21, 2025
Copy link

netlify bot commented Apr 21, 2025

Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit bdc404c
🔍 Latest deploy log https://app.netlify.com/sites/gateway-api-inference-extension/deploys/68074f8278725b0008c28338
😎 Deploy Preview https://deploy-preview-721--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@nirrozenbaum
Copy link
Contributor Author

cc @ahg-g @kfswain @danehans

Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com>
}

hasCapacityFilter = &basicFilter{
name: "has capacity for sheddable requests",
filter: toFilterFunc(queueThresholdPredicate(config.QueueThresholdCritical).and(kvCacheThresholdPredicate(config.KVCacheThreshold))),
}

dropRequestFilter = &basicFilter{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer we not remove any existing code to prevent regression

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dropRequestFilter was never in real use, cause we never check error in code.
the only place is this line in Schedule function:

if err != nil || len(pods) == 0 { ...

and for that we don't need the error return value, nor the dropRequestFilter (which seems very odd.. it's not a filter)

}

return filtered_available, nil
Copy link
Collaborator

@kfswain kfswain Apr 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh...we never returned an error? I wonder if there is a go linter that checks for this kind of thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly. no use of error. also no use of DropRequestFilter.
the scheduler can just check if len(returned_pods)==0 (up until today scheduler did both err check and that).
that was one of my comments in the original PR:
https://github.com/kubernetes-sigs/gateway-api-inference-extension/pull/677/files#r2042685374

@kfswain
Copy link
Collaborator

kfswain commented Apr 21, 2025

This seems reasonably thin, I would have even preferred a more cautious approach where we duplicate much of the code. But a lot of this seems to just be non-functional cleanup.

@nirrozenbaum
Copy link
Contributor Author

This seems reasonably thin, I would have even preferred a more cautious approach where we duplicate much of the code. But a lot of this seems to just be non-functional cleanup.

indeed, most of the changes here are non-functional cleanup to adapt to the new filter interface and to the updated Pod interface.

Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com>
@kfswain
Copy link
Collaborator

kfswain commented Apr 23, 2025

We can close this now that the other PR has been merged, sorry for the confusion

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 23, 2025
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@nirrozenbaum
Copy link
Contributor Author

closing since #677 was merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants