Skip to content

Commit

Permalink
ignore spark.driver.host in yarn-cluster mode
Browse files Browse the repository at this point in the history
  • Loading branch information
WangTaoTheTonic committed Nov 5, 2014
1 parent 5f13759 commit 2286e6b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions core/src/main/scala/org/apache/spark/SparkContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,6 @@ class SparkContext(config: SparkConf) extends SparkStatusAPI with Logging {
logInfo("Spark configuration:\n" + conf.toDebugString)
}

// Set Spark driver host and port system properties
conf.setIfMissing("spark.driver.host", Utils.localHostName())
conf.setIfMissing("spark.driver.port", "0")

val jars: Seq[String] =
conf.getOption("spark.jars").map(_.split(",")).map(_.filter(_.size != 0)).toSeq.flatten

Expand Down Expand Up @@ -206,6 +202,14 @@ class SparkContext(config: SparkConf) extends SparkStatusAPI with Logging {

if (master == "yarn-client") System.setProperty("SPARK_YARN_MODE", "true")

// Set Spark driver host and port system properties. Ignore host setting in yarn-cluster mode.
if (master == "yarn-cluster") {
conf.set("spark.driver.host", Utils.localHostName())
} else {
conf.setIfMissing("spark.driver.host", Utils.localHostName())
}
conf.setIfMissing("spark.driver.port", "0")

// An asynchronous listener bus for Spark events
private[spark] val listenerBus = new LiveListenerBus

Expand Down

0 comments on commit 2286e6b

Please sign in to comment.