File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
core/src/main/scala/org/apache/spark Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -175,10 +175,6 @@ class SparkContext(config: SparkConf) extends SparkStatusAPI with Logging {
175175 logInfo(" Spark configuration:\n " + conf.toDebugString)
176176 }
177177
178- // Set Spark driver host and port system properties
179- conf.setIfMissing(" spark.driver.host" , Utils .localHostName())
180- conf.setIfMissing(" spark.driver.port" , " 0" )
181-
182178 val jars : Seq [String ] =
183179 conf.getOption(" spark.jars" ).map(_.split(" ," )).map(_.filter(_.size != 0 )).toSeq.flatten
184180
@@ -206,6 +202,14 @@ class SparkContext(config: SparkConf) extends SparkStatusAPI with Logging {
206202
207203 if (master == " yarn-client" ) System .setProperty(" SPARK_YARN_MODE" , " true" )
208204
205+ // Set Spark driver host and port system properties. Ignore host setting in yarn-cluster mode.
206+ if (master == " yarn-cluster" ) {
207+ conf.set(" spark.driver.host" , Utils .localHostName())
208+ } else {
209+ conf.setIfMissing(" spark.driver.host" , Utils .localHostName())
210+ }
211+ conf.setIfMissing(" spark.driver.port" , " 0" )
212+
209213 // An asynchronous listener bus for Spark events
210214 private [spark] val listenerBus = new LiveListenerBus
211215
You can’t perform that action at this time.
0 commit comments