File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
core/src/main/scala/org/apache/spark/deploy Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -71,9 +71,15 @@ object RRunner {
7171 val builder = new ProcessBuilder (Seq (rCommand, rFileNormalized) ++ otherArgs)
7272 val env = builder.environment()
7373 env.put(" EXISTING_SPARKR_BACKEND_PORT" , sparkRBackendPort.toString)
74- // The SparkR package distributed as an archive resource should be pointed to
75- // by a symbol link "sparkr" in the current directory.
76- val rPackageDir = new File (" sparkr" ).getAbsolutePath
74+ val rPackageDir =
75+ if (System .getProperty(" spark.master" ) == " yarn-cluster" ) {
76+ // The SparkR package distributed as an archive resource should be pointed to
77+ // by a symbol link "sparkr" in the current directory.
78+ new File (" sparkr" ).getAbsolutePath
79+ } else {
80+ val sparkHome = System .getenv(" SPARK_HOME" )
81+ Seq (sparkHome, " R" , " lib" ).mkString(File .separator)
82+ }
7783 env.put(" SPARKR_PACKAGE_DIR" , rPackageDir)
7884 env.put(" R_PROFILE_USER" ,
7985 Seq (rPackageDir, " SparkR" , " profile" , " general.R" ).mkString(File .separator))
You can’t perform that action at this time.
0 commit comments