File tree Expand file tree Collapse file tree 3 files changed +14
-8
lines changed
core/src/main/scala/org/apache/spark/scheduler/cluster/mesos Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -125,8 +125,10 @@ private[spark] class CoarseMesosSchedulerBackend(
125125 conf.get(" spark.driver.port" ),
126126 CoarseGrainedSchedulerBackend .ENDPOINT_NAME )
127127
128- val uri = conf.get(" spark.executor.uri" , null )
129- if (uri == null ) {
128+ val uri = conf.getOption(" spark.executor.uri" )
129+ .orElse(Option (System .getenv(" SPARK_EXECUTOR_URI" )))
130+
131+ if (uri.isEmpty) {
130132 val runScript = new File (executorSparkHome, " ./bin/spark-class" ).getCanonicalPath
131133 command.setValue(
132134 " %s \" %s\" org.apache.spark.executor.CoarseGrainedExecutorBackend"
@@ -139,7 +141,7 @@ private[spark] class CoarseMesosSchedulerBackend(
139141 } else {
140142 // Grab everything to the first '.'. We'll use that and '*' to
141143 // glob the directory "correctly".
142- val basename = uri.split('/' ).last.split('.' ).head
144+ val basename = uri.get. split('/' ).last.split('.' ).head
143145 command.setValue(
144146 s " cd $basename*; $prefixEnv " +
145147 " ./bin/spark-class org.apache.spark.executor.CoarseGrainedExecutorBackend" +
@@ -148,7 +150,7 @@ private[spark] class CoarseMesosSchedulerBackend(
148150 s " --hostname ${offer.getHostname}" +
149151 s " --cores $numCores" +
150152 s " --app-id $appId" )
151- command.addUris(CommandInfo .URI .newBuilder().setValue(uri))
153+ command.addUris(CommandInfo .URI .newBuilder().setValue(uri.get ))
152154 }
153155 command.build()
154156 }
Original file line number Diff line number Diff line change @@ -181,6 +181,8 @@ private[spark] class MesosClusterScheduler(conf: SparkConf)
181181 val cmdOptions = generateCmdOption(req)
182182
183183 val executorUri = req.conf.getOption(" spark.executor.uri" )
184+ .orElse(req.desc.command.environment.get(" SPARK_EXECUTOR_URI" ))
185+
184186 val cmd = if (executorUri.isDefined) {
185187 builder.addUris(CommandInfo .URI .newBuilder().setValue(executorUri.get).build())
186188
Original file line number Diff line number Diff line change @@ -101,17 +101,19 @@ private[spark] class MesosSchedulerBackend(
101101 }
102102 val command = CommandInfo .newBuilder()
103103 .setEnvironment(environment)
104- val uri = sc.conf.get(" spark.executor.uri" , null )
104+ val uri = sc.conf.getOption(" spark.executor.uri" )
105+ .orElse(Option (System .getenv(" SPARK_EXECUTOR_URI" )))
106+
105107 val executorBackendName = classOf [MesosExecutorBackend ].getName
106- if (uri == null ) {
108+ if (uri.isEmpty ) {
107109 val executorPath = new File (executorSparkHome, " /bin/spark-class" ).getCanonicalPath
108110 command.setValue(s " $prefixEnv $executorPath $executorBackendName" )
109111 } else {
110112 // Grab everything to the first '.'. We'll use that and '*' to
111113 // glob the directory "correctly".
112- val basename = uri.split('/' ).last.split('.' ).head
114+ val basename = uri.get. split('/' ).last.split('.' ).head
113115 command.setValue(s " cd ${basename}*; $prefixEnv ./bin/spark-class $executorBackendName" )
114- command.addUris(CommandInfo .URI .newBuilder().setValue(uri))
116+ command.addUris(CommandInfo .URI .newBuilder().setValue(uri.get ))
115117 }
116118 val cpus = Resource .newBuilder()
117119 .setName(" cpus" )
You can’t perform that action at this time.
0 commit comments