Skip to content

Commit d9aee07

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]>
1 parent 078894c commit d9aee07

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
@@ -279,6 +279,11 @@ object SparkSubmit {
279279
sysProps.getOrElseUpdate(k, v)
280280
}
281281

282+
// Ignore invalid spark.driver.host in cluster modes.
283+
if (deployMode == CLUSTER) {
284+
sysProps -= ("spark.driver.host")
285+
}
286+
282287
// Resolve paths in certain spark properties
283288
val pathConfigs = Seq(
284289
"spark.jars",

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
@@ -36,7 +36,7 @@ class ApplicationMasterArguments(val args: Array[String]) {
3636

3737
var args = inputArgs
3838

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

0 commit comments

Comments
 (0)