Skip to content
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

Merged
merged 2 commits into from Oct 10, 2020

Conversation

everpeace
Copy link
Contributor

@everpeace everpeace commented Jul 29, 2020

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 into PreemptHanlde(though PluginRunner 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 in PluginRunner can achieve this.

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Scheduling Framework: expose Run[Pre]ScorePlugins functions to PreemptionHandle which can be used in PostFilter extention point.

@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Jul 29, 2020
@k8s-ci-robot
Copy link
Contributor

@everpeace: The label(s) sig/ cannot be applied, because the repository doesn't have them

In response to this:

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 into PreemptHanlde(though PluginRunner interface) can give out-of-tree plugins more flexibility to implement their preemption plugins, without reinventing existing Score algorithms.

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

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.

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 29, 2020
@everpeace
Copy link
Contributor Author

/assign @Huang-Wei

could you kindly review this??

@everpeace
Copy link
Contributor Author

/retest

Copy link
Member

@Huang-Wei Huang-Wei left a 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?

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 31, 2020
@everpeace
Copy link
Contributor Author

everpeace commented Jul 31, 2020

LGTM, but we cannot make it to 1.19.

don't worry. no problem.

BTW: could you add some tests?

sorry, I missed that. I added PostFilter plugin test in framework/framework_test.go. PTAL.

@everpeace
Copy link
Contributor Author

/retest

1 similar comment
@everpeace
Copy link
Contributor Author

/retest

for _, nodeInfo := range nodeInfos {
nodes = append(nodes, nodeInfo.Node())
}
ph.RunScorePlugins(ctx, state, pod, nodes)
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

okay, thanks!

Copy link
Member

@Huang-Wei Huang-Wei left a 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?

pkg/scheduler/framework/v1alpha1/interface.go Outdated Show resolved Hide resolved
test/integration/scheduler/framework_test.go Outdated Show resolved Hide resolved
test/integration/scheduler/framework_test.go Show resolved Hide resolved
test/integration/scheduler/framework_test.go Show resolved Hide resolved
Copy link
Contributor Author

@everpeace everpeace left a 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.

test/integration/scheduler/framework_test.go Show resolved Hide resolved
@@ -748,7 +797,7 @@ func TestScorePlugin(t *testing.T) {
}
}

if scorePlugin.numScoreCalled == 0 {
if numScoreCalled := atomic.LoadInt32(&scorePlugin.numScoreCalled); numScoreCalled == 0 {
Copy link
Contributor Author

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,
Copy link
Contributor Author

@everpeace everpeace Aug 4, 2020

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

Copy link
Member

@Huang-Wei Huang-Wei left a 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?

@ahg-g
Copy link
Member

ahg-g commented Aug 8, 2020

LGTM now. @ahg-g are you ok with introducing Run[Pre]ScorePlugins to PluginRunner?

I can't think of a reason why not.

@Huang-Wei
Copy link
Member

Thanks @everpeace !

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 8, 2020
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 8, 2020
@ahg-g
Copy link
Member

ahg-g commented Aug 21, 2020

/priority important-longterm

@k8s-ci-robot k8s-ci-robot added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Aug 21, 2020
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Oct 9, 2020
@everpeace
Copy link
Contributor Author

/test pull-kubernetes-e2e-kind-ipv6

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

1 similar comment
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@Huang-Wei
Copy link
Member

/retest

@k8s-ci-robot k8s-ci-robot merged commit c72b30b into kubernetes:master Oct 10, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.20 milestone Oct 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants