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

Add option to round up CPU quota #79

Merged
merged 6 commits into from
Feb 13, 2024

Conversation

wallee94
Copy link
Contributor

@wallee94 wallee94 commented Oct 12, 2023

Add a RoundQuotaFunc option to control how the CPU quota should be rounded. The default is still rounding down (floor).
This is related to issue #78

@CLAassistant
Copy link

CLAassistant commented Oct 12, 2023

CLA assistant check
All committers have signed the CLA.

@wallee94 wallee94 force-pushed the add-option-to-round-up branch from 35683e6 to f5ff8d2 Compare October 12, 2023 18:08
@wallee94
Copy link
Contributor Author

wallee94 commented Oct 12, 2023

I just noticed there's a similar PR. This one's also related to the comments in #68

Copy link
Contributor

@abhinav abhinav left a comment

Choose a reason for hiding this comment

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

Thanks for making this change, @wallee94!
I think the maintainers might find this change more digestible.
I've left a comment about one possible improvement, but I'll defer to the maintainers on it.

CC @r-hang @sywhang @mway

maxprocs/maxprocs.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Oct 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c9adbb9) 93.19% compared to head (b686bfa) 93.96%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #79      +/-   ##
==========================================
+ Coverage   93.19%   93.96%   +0.77%     
==========================================
  Files           9       10       +1     
  Lines         338      348      +10     
==========================================
+ Hits          315      327      +12     
+ Misses         19       16       -3     
- Partials        4        5       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wallee94 wallee94 force-pushed the add-option-to-round-up branch from 16897d2 to 57c88e3 Compare November 21, 2023 03:39
@wallee94
Copy link
Contributor Author

Added a few tests for the new lines in runtime. I don't have linux so I couldn't run them on my local. I'll have to wait for the checks here 👀

@sandyskies
Copy link

@sywhang

Copy link
Contributor

@abhinav abhinav left a comment

Choose a reason for hiding this comment

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

LGTM save minor edits and a suggested fix for being able to use the RoundQuota option.
I'm not a maintainer, though, so I'll defer to @sywhang @r-hang and @mway.

internal/runtime/cpu_quota_linux.go Outdated Show resolved Hide resolved
internal/runtime/runtime.go Outdated Show resolved Hide resolved
internal/runtime/runtime.go Outdated Show resolved Hide resolved
maxprocs/maxprocs.go Outdated Show resolved Hide resolved
@wallee94
Copy link
Contributor Author

wallee94 commented Dec 7, 2023

I finally set up a linux machine to run those tests! I also changed the implementation to take a round function in the option instead of setting the operation with a const value. I felt it was simpler to use and maintain.

Copy link
Contributor

@r-hang r-hang left a comment

Choose a reason for hiding this comment

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

looks good to me.

Does it make sense to test the round == nil case within internal/runtime since that's newly added?

@wallee94
Copy link
Contributor Author

@r-hang Sure! Added a test to check that the value is rounded down then the round arg is nil

@r-hang r-hang merged commit 8553d3b into uber-go:master Feb 13, 2024
5 checks passed
@wallee94 wallee94 deleted the add-option-to-round-up branch February 13, 2024 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants