Skip to content

Commit 681afb0

Browse files
author
Sun Rui
committed
Fix a bug that RRunner does not handle client deployment modes.
1 parent cedfbe2 commit 681afb0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

core/src/main/scala/org/apache/spark/deploy/RRunner.scala

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff 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))

0 commit comments

Comments
 (0)