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

Simplify flavorassigner to only return bool if borrowing is required #1498

Merged
merged 1 commit into from
Dec 21, 2023

Conversation

mimowo
Copy link
Contributor

@mimowo mimowo commented Dec 20, 2023

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

To make the logic simpler, and easier to modify in #1397.

Which issue(s) this PR fixes:

Part of #1337

Special notes for your reviewer:

The only exported API where we use assignment.TotalBorrow is Borrows() used by scheduler:

func (a *Assignment) Borrows() bool {
	return len(a.TotalBorrow) > 0
}

So, it is much simpler to just keep a bool "borrowing" instead, it will also have better memory usage.

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 20, 2023
Copy link

netlify bot commented Dec 20, 2023

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit 73d8e4e
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/6582bd93228e3b0008823794

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 20, 2023
@mimowo mimowo force-pushed the simplify-flavor-assigner branch from c5b001e to 73d8e4e Compare December 20, 2023 10:10
@mimowo
Copy link
Contributor Author

mimowo commented Dec 20, 2023

/assign @yaroslava-serdiuk

@yaroslava-serdiuk
Copy link
Contributor

yaroslava-serdiuk commented Dec 20, 2023

Nice 👍
/lgtm

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

LGTM label has been added.

Git tree hash: e57d0128dd4ffaf46ab85b487cc0473c54dca7ab

@mimowo
Copy link
Contributor Author

mimowo commented Dec 20, 2023

/assign @alculquicondor @tenzen-y

Copy link
Member

@tenzen-y tenzen-y left a comment

Choose a reason for hiding this comment

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

As I can see the commit history, the TotalBorrow looks like there have been no changes since we implemented flavorAssigner: #454

Also, the scheduler's borrowing implementation based on flavorAssigner looks like there have been no changes since we implemented the kueue 2 years ago:

// borrows is the resouces that the workload would need to borrow from the
// cohort if it was scheduled in the capacity.
borrows capacity.Resources

Furthermore, we have been using TotalBorrow only to confirm if the podSet borrows resources from others. In other words, we have never used stored borrowed resources in TotalBorrow anywhere since we implemented the kueue scheduler.

So, I think that this simplification would be better since we can reduce unneeded calculation costs and avoid no need complications.
cc: @alculquicondor

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mimowo, tenzen-y

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 Dec 21, 2023
@k8s-ci-robot k8s-ci-robot merged commit 807b2d5 into kubernetes-sigs:main Dec 21, 2023
15 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v0.6 milestone Dec 21, 2023
@alculquicondor
Copy link
Contributor

The information could have been useful for debugging, but otherwise not necessary in production.

@mimowo mimowo deleted the simplify-flavor-assigner branch February 10, 2024 11:48
kannon92 pushed a commit to openshift-kannon92/kubernetes-sigs-kueue that referenced this pull request Nov 19, 2024
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. 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.

5 participants