-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-4697][YARN]System properties should override environment variables #3557
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
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5f43f45
System property can override environment variable
WangTaoTheTonic 40934b4
just switch blocks
WangTaoTheTonic 81833bb
rebase
WangTaoTheTonic bee9447
wrong brace
WangTaoTheTonic 1262d57
handle spark.app.name and SPARK_YARN_APP_NAME in SparkSubmitArguments
WangTaoTheTonic e3e486a
remove the comma
WangTaoTheTonic 836b9ef
fix type mismatch
WangTaoTheTonic 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,8 +76,7 @@ private[spark] class YarnClientSchedulerBackend( | |
| ("--executor-memory", "SPARK_EXECUTOR_MEMORY", "spark.executor.memory"), | ||
| ("--executor-cores", "SPARK_WORKER_CORES", "spark.executor.cores"), | ||
| ("--executor-cores", "SPARK_EXECUTOR_CORES", "spark.executor.cores"), | ||
| ("--queue", "SPARK_YARN_QUEUE", "spark.yarn.queue"), | ||
| ("--name", "SPARK_YARN_APP_NAME", "spark.app.name") | ||
| ("--queue", "SPARK_YARN_QUEUE", "spark.yarn.queue") | ||
| ) | ||
| // Warn against the following deprecated environment variables: env var -> suggestion | ||
| val deprecatedEnvVars = Map( | ||
|
|
@@ -88,18 +87,19 @@ private[spark] class YarnClientSchedulerBackend( | |
| // Do the same for deprecated properties: property -> suggestion | ||
| val deprecatedProps = Map("spark.master.memory" -> "--driver-memory through spark-submit") | ||
| optionTuples.foreach { case (optionName, envVar, sparkProp) => | ||
| if (System.getenv(envVar) != null) { | ||
| extraArgs += (optionName, System.getenv(envVar)) | ||
| if (deprecatedEnvVars.contains(envVar)) { | ||
| logWarning(s"NOTE: $envVar is deprecated. Use ${deprecatedEnvVars(envVar)} instead.") | ||
| } | ||
| } else if (sc.getConf.contains(sparkProp)) { | ||
| if (sc.getConf.contains(sparkProp)) { | ||
| extraArgs += (optionName, sc.getConf.get(sparkProp)) | ||
| if (deprecatedProps.contains(sparkProp)) { | ||
| logWarning(s"NOTE: $sparkProp is deprecated. Use ${deprecatedProps(sparkProp)} instead.") | ||
| } | ||
| } else if (System.getenv(envVar) != null) { | ||
| extraArgs += (optionName, System.getenv(envVar)) | ||
| if (deprecatedEnvVars.contains(envVar)) { | ||
| logWarning(s"NOTE: $envVar is deprecated. Use ${deprecatedEnvVars(envVar)} instead.") | ||
| } | ||
| } | ||
| } | ||
| sc.getConf.getOption("spark.app.name").foreach(v => extraArgs += ("--name", v)) | ||
|
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. We need to add a comment here to explain why it's a special case |
||
| extraArgs | ||
| } | ||
|
|
||
|
|
||
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.
should be
startsWith, also in the comments we generally capitalize YARNThere 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.
Just to be clear, you mean capitalize YARN in the comment, 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.
yeah
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.
Woops didn't see your wrote comments, sorry for the noise