-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-3456] YarnAllocator on alpha can lose container requests to RM #2373
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
If we expose the number of requests pending to the subclass, we don't need to make this take an extra parameter. E.g.
Then the alpha
YarnAllocationHandler#allocateContainers
can add this tocount
instead of the new parameter.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.
True but it seems kind of weird to have it pass count but then grab a global for pending. It would also be easier to unit test taking it as paramater (if we had unit tests for this)
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 just thought it would simplify the method signatures. Right now the stable code takes in a parameter that it doesn't use, and in the alpha code all we do with those two parameters is add them together anyway. The number of pending container requests is a property of the allocator, so I think it makes sense if all methods in the class have access to this. (Not a huge deal)
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 understand the concern over the interfaces, but in the end hopefully this doesn't matter as hopefully we will be removing alpha support in another release. Also its an internal private interface.
To me this is safer to have one unused variable vs exposing a private variable. For instance, you will notice that if I removed all changes to YarnAllocator (except for making numPendingAllocate protected) and just grabbed it from the alpha/YarnAllocateHandler, it would be wrong - it would ask for 2x the number because we increment the numberPendig before calling allocateContainers. To me exposing that variable could more easily lead to issues like that and perhaps others accessing it and leading to more complicated usage numPending in the future. It also seems more brittle if someone comes in here and refactors things again.
I could change YarnAllocator to rearrange it to call allocateContainers before incrementing numPending for now and put comment there saying the order matters.
I would prefer to leave it, but If you would really like me to I will.
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 think it's safe to expose the variable as long as it does what its name suggests. We actually already do this elsewhere in the same class for similar variables (e.g.
getNumExecutorRunning
orgetNumExecutorFailed
). In our case, we can't make just those changes because we incrementnumPendingAllocate
before weallocateContainers
, but we can easily work around that as you mentioned. These allocation requests aren't technically pending until we've submitted them, so I think it's actually more correct to incrementnumPendingAllocate
afterwards.Anyway, just a minor suggestion since this is an internal API. It's fine to leave it as is if you prefer.