Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/1986#discussion_r16700565
--- Diff:
core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/CoarseMesosSchedulerBackend.scala
---
@@ -111,48 +113,43 @@ private[spark] class CoarseMesosSchedulerBackend(
def createCommand(offer: Offer, numCores: Int): CommandInfo = {
val environment = Environment.newBuilder()
- val extraClassPath = conf.getOption("spark.executor.extraClassPath")
- extraClassPath.foreach { cp =>
- environment.addVariables(
-
Environment.Variable.newBuilder().setName("SPARK_CLASSPATH").setValue(cp).build())
- }
+ val mesosCommand = CommandInfo.newBuilder()
+ .setEnvironment(environment)
+
+ val driverUrl = "akka.tcp://spark@%s:%s/user/%s".format(
+ conf.get("spark.driver.host"), conf.get("spark.driver.port"),
+ CoarseGrainedSchedulerBackend.ACTOR_NAME)
+ val args = Seq(driverUrl, offer.getSlaveId.getValue,
offer.getHostname, numCores.toString)
val extraJavaOpts = conf.getOption("spark.executor.extraJavaOptions")
+ .map(Utils.splitCommandString).getOrElse(Seq.empty)
- val libraryPathOption = "spark.executor.extraLibraryPath"
- val extraLibraryPath = conf.getOption(libraryPathOption).map(p =>
s"-Djava.library.path=$p")
- val extraOpts = Seq(extraJavaOpts,
extraLibraryPath).flatten.mkString(" ")
+ // Start executors with a few necessary configs for registering with
the scheduler
+ val sparkJavaOpts = Utils.sparkJavaOpts(conf,
SparkConf.isExecutorStartupConf)
+ val javaOpts = sparkJavaOpts ++ extraJavaOpts
- sc.executorEnvs.foreach { case (key, value) =>
- environment.addVariables(Environment.Variable.newBuilder()
- .setName(key)
- .setValue(value)
- .build())
+ val classPathEntries =
conf.getOption("spark.executor.extraClassPath").toSeq.flatMap { cp =>
+ cp.split(java.io.File.pathSeparator)
}
- val command = CommandInfo.newBuilder()
- .setEnvironment(environment)
- val driverUrl = "akka.tcp://spark@%s:%s/user/%s".format(
- conf.get("spark.driver.host"),
- conf.get("spark.driver.port"),
- CoarseGrainedSchedulerBackend.ACTOR_NAME)
+ val libraryPathEntries =
+ conf.getOption("spark.executor.extraLibraryPath").toSeq.flatMap { cp
=>
+ cp.split(java.io.File.pathSeparator)
+ }
+
+ val command = Command(
+ "org.apache.spark.executor.CoarseGrainedExecutorBackend", args,
sc.executorEnvs,
--- End diff --
Only passing `sc.executorEnvs` here to the `command` object here is not
enough. Because we only use `command` with `CommandUtils.buildCommandSeq` below
to generate the command line string, and in this case, `command.environment` is
only used to run `bin/compute-classpath` (see
[here](https://github.com/apache/spark/blob/b21ae5bbb9baa966f69303a30659aa8bbb2098da/core/src/main/scala/org/apache/spark/deploy/worker/CommandUtils.scala#L69-L71)),
not propagated to the target executor process.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]