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
[MINOR][YARN] Make memLimitExceededLogMessage more clean #23030
Conversation
Test build #98814 has finished for PR 23030 at commit
|
cc @vanzin |
Because there are just two calls to this method, and now they behave pretty differently based on one argument, how about just inlining both calls and the regexes to make this simpler? |
Test build #98859 has finished for PR 23030 at commit
|
val pmemMsg = memLimitExceededLogMessage(diagnostics, PMEM_EXCEEDED_PATTERN) | ||
assert(vmemMsg.contains("5.8 GB of 4.2 GB virtual memory used.")) | ||
assert(pmemMsg.contains("2.1 MB of 2 GB physical memory used.")) | ||
def logMessage(pattern: Pattern): String = { |
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 feel strongly about it, but I could just remove this test too, and inline the regexes to simplify this. This was just testing the exact error message and I don't know how useful that is.
} else { | ||
"" | ||
} | ||
val matcher = VMEM_EXCEEDED_PATTERN.matcher(completedContainer.getDiagnostics) |
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.
You can inline these patterns to further simplify.
Test build #98877 has finished for PR 23030 at commit
|
(true, memLimitExceededLogMessage( | ||
completedContainer.getDiagnostics, | ||
PMEM_EXCEEDED_PATTERN)) | ||
val suggestion = s"Consider boosting ${EXECUTOR_MEMORY_OVERHEAD.key}" |
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.
Why isn't this a suggestion in the vmem case too? It can help, even if it's a sledgehammer. Otherwise, you're basically telling the user in that case: "whatcha gonna do? it failed."
(true, memLimitExceededLogMessage( | ||
completedContainer.getDiagnostics, | ||
VMEM_EXCEEDED_PATTERN)) | ||
val suggestion = if (conf.getBoolean(YarnConfiguration.NM_VMEM_CHECK_ENABLED, |
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.
Can you even get into this place if vmem checks are disabled?
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.
Ah, and another option that can help here is yarn.nodemanager.vmem-pmem-ratio
.
val matcher = PMEM_EXCEEDED_PATTERN.matcher(completedContainer.getDiagnostics) | ||
val diag = if (matcher.find()) " " + matcher.group() + "." else "" | ||
val message = | ||
s"Container killed by YARN for exceeding physical memory limits.$diag $suggestion." |
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.
Ignoring the above comment, suggestion
is always set, so it could be inlined here.
Separately, it's always sub-optimal when formatting is scattered among different variables (e.g. the period at the end of the suggestion is here, the space before the diag is in the diag message itself).
Test build #98910 has finished for PR 23030 at commit
|
Pattern.compile(s"$MEM_REGEX of $MEM_REGEX physical memory used") | ||
val VMEM_EXCEEDED_PATTERN = | ||
Pattern.compile(s"$MEM_REGEX of $MEM_REGEX virtual memory used") | ||
val PMEM_EXCEEDED_PATTERN = raw"$MEM_REGEX of $MEM_REGEX physical memory used".r |
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.
We can still inline these patterns right?
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.
Yes. I will do it.
Test build #98916 has finished for PR 23030 at commit
|
val vmemExceededPattern = raw"$MEM_REGEX of $MEM_REGEX virtual memory used".r | ||
val diag = vmemExceededPattern.findFirstIn(completedContainer.getDiagnostics) | ||
.map(_.concat(".")).getOrElse("") | ||
val additional = if (conf.getBoolean(YarnConfiguration.NM_VMEM_CHECK_ENABLED, |
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.
You didn't answer my question. How can you even get here if this config is disabled?
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 see.
Test build #98944 has finished for PR 23030 at commit
|
.map(_.concat(".")).getOrElse("") | ||
val message = "Container killed by YARN for exceeding virtual memory limits. " + | ||
s"$diag Consider boosting ${EXECUTOR_MEMORY_OVERHEAD.key} or disabling " + | ||
s"${YarnConfiguration.NM_VMEM_CHECK_ENABLED} because of YARN-4714." |
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.
Now you removed the other config option I asked you to add... :-/
Test build #98946 has finished for PR 23030 at commit
|
Merged to master |
## What changes were proposed in this pull request? Current `memLimitExceededLogMessage`: <img src="https://user-images.githubusercontent.com/5399861/48467789-ec8e1000-e824-11e8-91fc-280d342e1bf3.png" width="360"> It‘s not very clear, because physical memory exceeds but suggestion contains virtual memory config. This pr makes it more clear and replace deprecated config: ```spark.yarn.executor.memoryOverhead```. ## How was this patch tested? manual tests Closes apache#23030 from wangyum/EXECUTOR_MEMORY_OVERHEAD. Authored-by: Yuming Wang <yumwang@ebay.com> Signed-off-by: Sean Owen <sean.owen@databricks.com>
What changes were proposed in this pull request?
Current
memLimitExceededLogMessage
:It‘s not very clear, because physical memory exceeds but suggestion contains virtual memory config. This pr makes it more clear and replace deprecated config:
spark.yarn.executor.memoryOverhead
.How was this patch tested?
manual tests