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
scheduler: expose Run[Pre]ScorePlugins functions to PreemptionHandle(through PluginRunner) #93534
scheduler: expose Run[Pre]ScorePlugins functions to PreemptionHandle(through PluginRunner) #93534
Conversation
@everpeace: The label(s) In response to this:
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/test-infra repository. |
/assign @Huang-Wei could you kindly review this?? |
/retest |
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, but we cannot make it to 1.19.
BTW: could you add some tests?
cf08b16
to
01adfeb
Compare
don't worry. no problem.
sorry, I missed that. I added |
/retest |
1 similar comment
/retest |
for _, nodeInfo := range nodeInfos { | ||
nodes = append(nodes, nodeInfo.Node()) | ||
} | ||
ph.RunScorePlugins(ctx, state, pod, nodes) |
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.
Not sure if we need some caveat here or in PluginsRunner
interface to make it clear that this is potentially for out-of-tree plugins only.
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.
Thanks for the comment. I think I don't need comments here and PluginsRunner
because the scheduler framework is essentially for out-of-tree plugins.
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.
okay, thanks!
01adfeb
to
7b9abcb
Compare
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.
The CI failure is real. See comments below.
BTW: can you also update L792 to make the scoreNum is obtained atomically?
7b9abcb
to
d58058e
Compare
d58058e
to
d0421fa
Compare
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.
sorry for submitting poor test... I believe I fixed the integration test this time.
@@ -748,7 +797,7 @@ func TestScorePlugin(t *testing.T) { | |||
} | |||
} | |||
|
|||
if scorePlugin.numScoreCalled == 0 { | |||
if numScoreCalled := atomic.LoadInt32(&scorePlugin.numScoreCalled); numScoreCalled == 0 { |
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 mentioned in #93534 (review)
BTW: can you also update L792 to make the scoreNum is obtained atomically?
Sure, I updated to read numScoreCalled
with atomic
in TestPostFilterPlugin
, too.
expectPostFilterNumCalled int | ||
}{ | ||
{ | ||
name: "Filter passed", | ||
name: "Filter passed and Score success", | ||
numNodes: 3, |
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.
ref: #93534 (comment)
I introduced numNodes
in test case. I set it to 3
here and others to 1
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 now. @ahg-g are you ok with introducing Run[Pre]ScorePlugins to PluginRunner?
I can't think of a reason why not. |
Thanks @everpeace ! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: everpeace, 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 |
/priority important-longterm |
/test pull-kubernetes-e2e-kind-ipv6 |
/retest Review the full test history for this PR. Silence the bot with an |
1 similar comment
/retest Review the full test history for this PR. Silence the bot with an |
/retest |
What type of PR is this?
/kind feature
/sig scheduling
What this PR does / why we need it:
As discussed in #90711 (comment), adding
RunScorePlugins
intoPreemptHanlde
(thoughPluginRunner
interface) can give out-of-tree plugins more flexibility to implement their preemption plugins, without reinventing existing Score algorithms.I think just adding
RunScorePlugins
definitions inPluginRunner
can achieve this.Special notes for your reviewer:
Does this PR introduce a user-facing change?: