aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwitgo <witgo@qq.com>2014-04-27 19:41:02 -0700
committerPatrick Wendell <pwendell@gmail.com>2014-04-27 19:41:02 -0700
commit71f4d2612a1be2904ed1536280680abc2dd212e7 (patch)
treec1303e5bf68839631e73207be42e47baaaa25eaa
parent6b3c6e5dd8e74435f71ecdb224db532550ef407b (diff)
downloadspark-71f4d2612a1be2904ed1536280680abc2dd212e7.tar.gz
spark-71f4d2612a1be2904ed1536280680abc2dd212e7.tar.bz2
spark-71f4d2612a1be2904ed1536280680abc2dd212e7.zip
Fix SPARK-1609: Executor fails to start when Command.extraJavaOptions contains multiple Java options
Author: witgo <witgo@qq.com> Closes #547 from witgo/SPARK-1609 and squashes the following commits: deb6a4c [witgo] review commit 91da0bb [witgo] Merge branch 'master' of https://github.com/apache/spark into SPARK-1609 0640852 [witgo] review commit 8f90b22 [witgo] Merge branch 'master' of https://github.com/apache/spark into SPARK-1609 bcf36cb [witgo] Merge branch 'master' of https://github.com/apache/spark into SPARK-1609 1185605 [witgo] fix extraJavaOptions split f7c0ab7 [witgo] bugfix 86fc4bb [witgo] bugfix 8a265b7 [witgo] Fix SPARK-1609: Executor fails to start when use spark-submit
-rw-r--r--core/src/main/scala/org/apache/spark/deploy/worker/CommandUtils.scala9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/src/main/scala/org/apache/spark/deploy/worker/CommandUtils.scala b/core/src/main/scala/org/apache/spark/deploy/worker/CommandUtils.scala
index 9103c885fa..3e615e753b 100644
--- a/core/src/main/scala/org/apache/spark/deploy/worker/CommandUtils.scala
+++ b/core/src/main/scala/org/apache/spark/deploy/worker/CommandUtils.scala
@@ -48,7 +48,8 @@ object CommandUtils extends Logging {
def buildJavaOpts(command: Command, memory: Int, sparkHome: String): Seq[String] = {
val memoryOpts = Seq(s"-Xms${memory}M", s"-Xmx${memory}M")
// Note, this will coalesce multiple options into a single command component
- val extraOpts = command.extraJavaOptions.toSeq
+ val extraOpts = command.extraJavaOptions.map(Utils.splitCommandString).getOrElse(Seq())
+
val libraryOpts =
if (command.libraryPathEntries.size > 0) {
val joined = command.libraryPathEntries.mkString(File.pathSeparator)
@@ -62,10 +63,10 @@ object CommandUtils extends Logging {
val classPath = Utils.executeAndGetOutput(
Seq(sparkHome + "/bin/compute-classpath" + ext),
extraEnvironment=command.environment)
- val userClassPath = command.classPathEntries.mkString(File.pathSeparator)
- val classPathWithUser = classPath + File.pathSeparator + userClassPath
+ val userClassPath = command.classPathEntries ++ Seq(classPath)
- Seq("-cp", classPathWithUser) ++ libraryOpts ++ extraOpts ++ memoryOpts
+ Seq("-cp", userClassPath.filterNot(_.isEmpty).mkString(File.pathSeparator)) ++
+ libraryOpts ++ extraOpts ++ memoryOpts
}
/** Spawn a thread that will redirect a given stream to a file */