aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorSun Rui <rui.sun@intel.com>2015-10-23 21:38:04 -0700
committerShivaram Venkataraman <shivaram@cs.berkeley.edu>2015-10-23 21:38:04 -0700
commit2462dbcce89d657bca17ae311c99c2a4bee4a5fa (patch)
tree5b0930e12edaa40510f2dc9fd7b4f0a92a944ccb /core
parent4725cb988b98f367c07214c4c3cfd1206fb2b5c2 (diff)
downloadspark-2462dbcce89d657bca17ae311c99c2a4bee4a5fa.tar.gz
spark-2462dbcce89d657bca17ae311c99c2a4bee4a5fa.tar.bz2
spark-2462dbcce89d657bca17ae311c99c2a4bee4a5fa.zip
[SPARK-10971][SPARKR] RRunner should allow setting path to Rscript.
Add a new spark conf option "spark.sparkr.r.driver.command" to specify the executable for an R script in client modes. The existing spark conf option "spark.sparkr.r.command" is used to specify the executable for an R script in cluster modes for both driver and workers. See also [launch R worker script](https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/api/r/RRDD.scala#L395). BTW, [envrionment variable "SPARKR_DRIVER_R"](https://github.com/apache/spark/blob/master/launcher/src/main/java/org/apache/spark/launcher/SparkSubmitCommandBuilder.java#L275) is used to locate R shell on the local host. For your information, PYSPARK has two environment variables serving simliar purpose: PYSPARK_PYTHON Python binary executable to use for PySpark in both driver and workers (default is `python`). PYSPARK_DRIVER_PYTHON Python binary executable to use for PySpark in driver only (default is PYSPARK_PYTHON). pySpark use the code [here](https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/deploy/PythonRunner.scala#L41) to determine the python executable for a python script. Author: Sun Rui <rui.sun@intel.com> Closes #9179 from sun-rui/SPARK-10971.
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/deploy/RRunner.scala11
1 files changed, 10 insertions, 1 deletions
diff --git a/core/src/main/scala/org/apache/spark/deploy/RRunner.scala b/core/src/main/scala/org/apache/spark/deploy/RRunner.scala
index 58cc1f9d96..ed183cf16a 100644
--- a/core/src/main/scala/org/apache/spark/deploy/RRunner.scala
+++ b/core/src/main/scala/org/apache/spark/deploy/RRunner.scala
@@ -40,7 +40,16 @@ object RRunner {
// Time to wait for SparkR backend to initialize in seconds
val backendTimeout = sys.env.getOrElse("SPARKR_BACKEND_TIMEOUT", "120").toInt
- val rCommand = "Rscript"
+ val rCommand = {
+ // "spark.sparkr.r.command" is deprecated and replaced by "spark.r.command",
+ // but kept here for backward compatibility.
+ var cmd = sys.props.getOrElse("spark.sparkr.r.command", "Rscript")
+ cmd = sys.props.getOrElse("spark.r.command", cmd)
+ if (sys.props.getOrElse("spark.submit.deployMode", "client") == "client") {
+ cmd = sys.props.getOrElse("spark.r.driver.command", cmd)
+ }
+ cmd
+ }
// Check if the file path exists.
// If not, change directory to current working directory for YARN cluster mode