Skip to content

Add option to round up CPU quota#79

Merged
r-hang merged 6 commits intouber-go:masterfrom
waltherlee:add-option-to-round-up
Feb 13, 2024
Merged

Add option to round up CPU quota#79
r-hang merged 6 commits intouber-go:masterfrom
waltherlee:add-option-to-round-up

Conversation

@waltherlee
Copy link
Copy Markdown
Contributor

@waltherlee waltherlee 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
Copy Markdown

CLAassistant commented Oct 12, 2023

CLA assistant check
All committers have signed the CLA.

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

waltherlee commented Oct 12, 2023

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

Copy link
Copy Markdown
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

Comment thread maxprocs/maxprocs.go Outdated
@codecov
Copy link
Copy Markdown

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.

@waltherlee waltherlee force-pushed the add-option-to-round-up branch from 16897d2 to 57c88e3 Compare November 21, 2023 03:39
@waltherlee
Copy link
Copy Markdown
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
Copy Markdown

@sywhang

Copy link
Copy Markdown
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.

Comment thread internal/runtime/cpu_quota_linux.go Outdated
Comment thread internal/runtime/runtime.go Outdated
Comment thread internal/runtime/runtime.go Outdated
Comment thread maxprocs/maxprocs.go Outdated
@waltherlee
Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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?

Signed-off-by: Walther Lee <walthere.lee@gmail.com>
@waltherlee
Copy link
Copy Markdown
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
@waltherlee waltherlee 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