-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-11082][YARN] Fix wrong core number when response vcore is less than requested vcore #9095
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -395,6 +395,10 @@ private[yarn] class YarnAllocator( | |
| val executorId = executorIdCounter.toString | ||
|
|
||
| assert(container.getResource.getMemory >= resource.getMemory) | ||
| if (container.getResource.getVirtualCores < resource.getVirtualCores) { | ||
| logWarning(s"Number of vcore ${container.getResource.getVirtualCores} in allocated " + | ||
| s"container response is less than the requested number ${resource.getVirtualCores}") | ||
| } | ||
|
|
||
| logInfo("Launching container %s for on host %s".format(containerId, executorHostname)) | ||
| executorIdToContainer(executorId) = container | ||
|
|
@@ -414,7 +418,7 @@ private[yarn] class YarnAllocator( | |
| executorId, | ||
| executorHostname, | ||
| executorMemory, | ||
| executorCores, | ||
| container.getResource.getVirtualCores, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this actually fail when using executorCores? |
||
| appAttemptId.getApplicationId.toString, | ||
| securityMgr) | ||
| if (launchContainers) { | ||
|
|
||
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.
@srowen , we already had such defensive code for memory.
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, I mean, should we expect there is a case where the granted memory is less than requested as well? and allow or handle it? right now it's rejected, so I expect it can't happen. But then again the code seemed to assume that (sort of) about vcores too.
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.
Not sure from Yarn side the granted memory will possibly be less than the requested, I haven't met such problem yet.
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.
memory should never be less then requested. vcores support was added later though and if its configured off or the scheduler doesn't support it then its possible to get back less. Like mentioned the defaultResourceCalculator just always returns 1.
There is already a comment on this at matchContainerToRequest. Is this actually failing or you were just surprised at what you got?
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 will not fail, just made me quite confused when looking at the cores I set is different from what displayed in yarn side.
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.
Note that wrong vcore accounting in Yarn can affect system integrity due to over-scheduling the CPU. It is mandatory to have this working correctly if spark has to play a nice citizen on yarn (together with other scheduled apps or itself).