Skip to content

Commit 5ac55c8

Browse files
WangTaoTheTonicJoshRosen
authored andcommitted
[SPARK-4253] Ignore spark.driver.host in yarn-cluster and standalone-cluster modes
In yarn-cluster and standalone-cluster modes, we don't know where driver will run until it is launched. If the `spark.driver.host` property is set on the submitting machine and propagated to the driver through SparkConf then this will lead to errors when the driver launches. This patch fixes this issue by dropping the `spark.driver.host` property in SparkSubmit when running in a cluster deploy mode. Author: WangTaoTheTonic <[email protected]> Author: WangTao <[email protected]> Closes #3112 from WangTaoTheTonic/SPARK4253 and squashes the following commits: ed1a25c [WangTaoTheTonic] revert unrelated formatting issue 02c4e49 [WangTao] add comment 32a3f3f [WangTaoTheTonic] ingore it in SparkSubmit instead of SparkContext 667cf24 [WangTaoTheTonic] document fix ff8d5f7 [WangTaoTheTonic] also ignore it in standalone cluster mode 2286e6b [WangTao] ignore spark.driver.host in yarn-cluster mode (cherry picked from commit 8106b1e) Signed-off-by: Josh Rosen <[email protected]> Conflicts: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala
1 parent 6c53225 commit 5ac55c8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@ object SparkSubmit {
284284
sysProps.getOrElseUpdate(k, v)
285285
}
286286

287+
// Ignore spark.driver.host in cluster modes (see SPARK-4253 for context):
288+
if (deployMode == CLUSTER) {
289+
sysProps -= "spark.driver.host"
290+
}
291+
287292
(childArgs, childClasspath, sysProps, childMainClass)
288293
}
289294

yarn/common/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMasterArguments.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ApplicationMasterArguments(val args: Array[String]) {
3535

3636
var args = inputArgs
3737

38-
while (! args.isEmpty) {
38+
while (!args.isEmpty) {
3939
// --num-workers, --worker-memory, and --worker-cores are deprecated since 1.0,
4040
// the properties with executor in their names are preferred.
4141
args match {

0 commit comments

Comments
 (0)