Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Don't exceed maximum resources #16
base: master
Are you sure you want to change the base?
Don't exceed maximum resources #16
Changes from 16 commits
5e91d8d
84eabb4
6774aaa
afc2c49
d4b837e
af6b8c3
0e92019
adb5d0e
398f59c
bdd77aa
1aa551e
a4ec89a
942ce06
992f835
60afcf8
494034b
408174d
2fbd73e
5fdacc6
85350eb
df0bdb0
afdbb40
a21d1a9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 code currently on
master
will treat this case as a programmererror
. I feel like this is a bad state, and fewererror
calls would be preferable. This PR clamps the value such thatmaxResources
is always less than or equal tonumStripes
, preferring to have more stripes with fewer resources each.I feel like
error
is worse than value clamping, but neither are great.Prior to this PR, the
max resources
parameter was not really establishing a "maximum count of resources." This PR makes it so that aPool
never has more resources than themaxResources
parameter.Alternatively, we could replace
poolMaxResources
withpoolResourcesPerStripe
. This has an unambiguous meaning, and could really simplify the code. The place where we currently calculate can be relocated to the deprecatedcreatePool
, which would determine (given anumStripes
andmaxResources
) a way to haveresourcesPerStripe * numStripes <= maxResources
.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.
Seeing as the number of capabilities is a runtime environment-specific detail that the programmer cannot know in advance, I think replacing
poolMaxResources
withpoolResourcesPerStripe
makes sense.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.
I don't have time to look at this any further, but I did wonder if it wouldn't be a pain in the ass to make the resource limits more expressive, something like
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.
For the record, this PR seems like an improvement over the status quo, and this whole discussion here could be inspiration for a followup. (I'm not asking for changes.)
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.
It appears swapped.