-
Notifications
You must be signed in to change notification settings - Fork 29k
[MINOR][YARN] Make memLimitExceededLogMessage more clean #23030
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 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e7ff43d
Make memLimitExceededLogMessage more clean
wangyum 44767f8
remove memLimitExceededLogMessage
wangyum 965a984
remove test
wangyum 8ab6c3b
java -> scala makes it more simple
wangyum 66b3e7f
inline patterns
wangyum 9ad6df4
fix error
wangyum ca008cd
Add NM_VMEM_PMEM_RATIO back
wangyum 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 |
|---|---|---|
|
|
@@ -20,7 +20,6 @@ package org.apache.spark.deploy.yarn | |
| import java.util.Collections | ||
| import java.util.concurrent._ | ||
| import java.util.concurrent.atomic.AtomicInteger | ||
| import java.util.regex.Pattern | ||
|
|
||
| import scala.collection.JavaConverters._ | ||
| import scala.collection.mutable | ||
|
|
@@ -598,13 +597,23 @@ private[yarn] class YarnAllocator( | |
| (false, s"Container ${containerId}${onHostStr} was preempted.") | ||
| // Should probably still count memory exceeded exit codes towards task failures | ||
| case VMEM_EXCEEDED_EXIT_CODE => | ||
| (true, memLimitExceededLogMessage( | ||
| completedContainer.getDiagnostics, | ||
| VMEM_EXCEEDED_PATTERN)) | ||
| val diag = VMEM_EXCEEDED_PATTERN.findFirstIn(completedContainer.getDiagnostics) | ||
| .map(_.concat(".")).getOrElse("") | ||
| val additional = if (conf.getBoolean(YarnConfiguration.NM_VMEM_CHECK_ENABLED, | ||
| YarnConfiguration.DEFAULT_NM_VMEM_CHECK_ENABLED)) { | ||
| s"or disabling ${YarnConfiguration.NM_VMEM_CHECK_ENABLED} because of YARN-4714" | ||
| } else { | ||
| s"or boosting ${YarnConfiguration.NM_VMEM_PMEM_RATIO}" | ||
| } | ||
| val message = "Container killed by YARN for exceeding virtual memory limits." + | ||
| s" $diag Consider boosting ${EXECUTOR_MEMORY_OVERHEAD.key} $additional." | ||
| (true, message) | ||
| case PMEM_EXCEEDED_EXIT_CODE => | ||
| (true, memLimitExceededLogMessage( | ||
| completedContainer.getDiagnostics, | ||
| PMEM_EXCEEDED_PATTERN)) | ||
| val diag = PMEM_EXCEEDED_PATTERN.findFirstIn(completedContainer.getDiagnostics) | ||
| .map(_.concat(".")).getOrElse("") | ||
| val message = "Container killed by YARN for exceeding physical memory limits." + | ||
| s" $diag Consider boosting ${EXECUTOR_MEMORY_OVERHEAD.key}." | ||
| (true, message) | ||
| case _ => | ||
| // all the failures which not covered above, like: | ||
| // disk failure, kill by app master or resource manager, ... | ||
|
|
@@ -735,18 +744,8 @@ private[yarn] class YarnAllocator( | |
|
|
||
| private object YarnAllocator { | ||
| val MEM_REGEX = "[0-9.]+ [KMG]B" | ||
| val PMEM_EXCEEDED_PATTERN = | ||
| 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 | ||
|
||
| val VMEM_EXCEEDED_PATTERN = raw"$MEM_REGEX of $MEM_REGEX virtual memory used".r | ||
| val VMEM_EXCEEDED_EXIT_CODE = -103 | ||
| val PMEM_EXCEEDED_EXIT_CODE = -104 | ||
|
|
||
| def memLimitExceededLogMessage(diagnostics: String, pattern: Pattern): String = { | ||
| val matcher = pattern.matcher(diagnostics) | ||
| val diag = if (matcher.find()) " " + matcher.group() + "." else "" | ||
| s"Container killed by YARN for exceeding memory limits. $diag " + | ||
| "Consider boosting spark.yarn.executor.memoryOverhead or " + | ||
| "disabling yarn.nodemanager.vmem-check-enabled because of YARN-4714." | ||
| } | ||
| } | ||
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.
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.