diff options
author | Marcelo Vanzin <vanzin@cloudera.com> | 2015-04-14 18:51:39 -0700 |
---|---|---|
committer | Andrew Or <andrew@databricks.com> | 2015-04-14 18:51:39 -0700 |
commit | 9717389365772d218cd7c67f9a13c3440f3c6791 (patch) | |
tree | e9e38c158b4ef1be9d580e0cb4d1e489b7f8dbbc /bin/spark-class2.cmd | |
parent | 6de282e2de3cb69f9b746d03fde581429248824a (diff) | |
download | spark-9717389365772d218cd7c67f9a13c3440f3c6791.tar.gz spark-9717389365772d218cd7c67f9a13c3440f3c6791.tar.bz2 spark-9717389365772d218cd7c67f9a13c3440f3c6791.zip |
[SPARK-6890] [core] Fix launcher lib work with SPARK_PREPEND_CLASSES.
The fix for SPARK-6406 broke the case where sub-processes are launched
when SPARK_PREPEND_CLASSES is set, because the code now would only add
the launcher's build directory to the sub-process's classpath instead
of the complete assembly.
This patch fixes the problem by having the launch scripts stash the
assembly's location in an environment variable. This is not the prettiest
solution, but it avoids having to plumb that location all the way through
the Worker code that launches executors. The env variable is always
set by the launch scripts, so users cannot override it.
Author: Marcelo Vanzin <vanzin@cloudera.com>
Closes #5504 from vanzin/SPARK-6890 and squashes the following commits:
7aec921 [Marcelo Vanzin] Fix tests.
ff87a60 [Marcelo Vanzin] Merge branch 'master' into SPARK-6890
31d3ce8 [Marcelo Vanzin] [SPARK-6890] [core] Fix launcher lib work with SPARK_PREPEND_CLASSES.
Diffstat (limited to 'bin/spark-class2.cmd')
-rw-r--r-- | bin/spark-class2.cmd | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bin/spark-class2.cmd b/bin/spark-class2.cmd index 4b3401d745..3d068dd3a2 100644 --- a/bin/spark-class2.cmd +++ b/bin/spark-class2.cmd @@ -46,13 +46,22 @@ if "%SPARK_ASSEMBLY_JAR%"=="0" ( exit /b 1 ) +set LAUNCH_CLASSPATH=%SPARK_ASSEMBLY_JAR% + +rem Add the launcher build dir to the classpath if requested. +if not "x%SPARK_PREPEND_CLASSES%"=="x" ( + set LAUNCH_CLASSPATH=%SPARK_HOME%\launcher\target\scala-%SPARK_SCALA_VERSION%\classes;%LAUNCH_CLASSPATH% +) + +set _SPARK_ASSEMBLY=%SPARK_ASSEMBLY_JAR% + rem Figure out where java is. set RUNNER=java if not "x%JAVA_HOME%"=="x" set RUNNER=%JAVA_HOME%\bin\java rem The launcher library prints the command to be executed in a single line suitable for being rem executed by the batch interpreter. So read all the output of the launcher into a variable. -for /f "tokens=*" %%i in ('cmd /C ""%RUNNER%" -cp %SPARK_ASSEMBLY_JAR% org.apache.spark.launcher.Main %*"') do ( +for /f "tokens=*" %%i in ('cmd /C ""%RUNNER%" -cp %LAUNCH_CLASSPATH% org.apache.spark.launcher.Main %*"') do ( set SPARK_CMD=%%i ) %SPARK_CMD% |