Skip to content

Commit dcbc426

Browse files
susanxhuynhsrowen
authored andcommitted
[SPARK-17964][SPARKR] Enable SparkR with Mesos client mode and cluster mode
## What changes were proposed in this pull request? Enabled SparkR with Mesos client mode and cluster mode. Just a few changes were required to get this working on Mesos: (1) removed the SparkR on Mesos error checks and (2) do not require "--class" to be specified for R apps. The logic to check spark.mesos.executor.home was already in there. sun-rui ## How was this patch tested? 1. SparkSubmitSuite 2. On local mesos cluster (on laptop): ran SparkR shell, spark-submit client mode, and spark-submit cluster mode, with the "examples/src/main/R/dataframe.R" example application. 3. On multi-node mesos cluster: ran SparkR shell, spark-submit client mode, and spark-submit cluster mode, with the "examples/src/main/R/dataframe.R" example application. I tested with the following --conf values set: spark.mesos.executor.docker.image and spark.mesos.executor.home This contribution is my original work and I license the work to the project under the project's open source license. Author: Susan X. Huynh <[email protected]> Closes #15700 from susanxhuynh/susan-r-branch. (cherry picked from commit 9a87c31) Signed-off-by: Sean Owen <[email protected]>
1 parent 446d72c commit dcbc426

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

core/src/main/scala/org/apache/spark/api/r/RUtils.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ private[spark] object RUtils {
8484
}
8585
} else {
8686
// Otherwise, assume the package is local
87-
// TODO: support this for Mesos
8887
val sparkRPkgPath = localSparkRPackagePath.getOrElse {
8988
throw new SparkException("SPARK_HOME not set. Can't locate SparkR package.")
9089
}

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -322,17 +322,14 @@ object SparkSubmit {
322322
}
323323

324324
// Require all R files to be local
325-
if (args.isR && !isYarnCluster) {
325+
if (args.isR && !isYarnCluster && !isMesosCluster) {
326326
if (Utils.nonLocalPaths(args.primaryResource).nonEmpty) {
327327
printErrorAndExit(s"Only local R files are supported: ${args.primaryResource}")
328328
}
329329
}
330330

331331
// The following modes are not supported or applicable
332332
(clusterManager, deployMode) match {
333-
case (MESOS, CLUSTER) if args.isR =>
334-
printErrorAndExit("Cluster deploy mode is currently not supported for R " +
335-
"applications on Mesos clusters.")
336333
case (STANDALONE, CLUSTER) if args.isPython =>
337334
printErrorAndExit("Cluster deploy mode is currently not supported for python " +
338335
"applications on standalone clusters.")
@@ -410,9 +407,9 @@ object SparkSubmit {
410407
printErrorAndExit("Distributing R packages with standalone cluster is not supported.")
411408
}
412409

413-
// TODO: Support SparkR with mesos cluster
414-
if (args.isR && clusterManager == MESOS) {
415-
printErrorAndExit("SparkR is not supported for Mesos cluster.")
410+
// TODO: Support distributing R packages with mesos cluster
411+
if (args.isR && clusterManager == MESOS && !RUtils.rPackages.isEmpty) {
412+
printErrorAndExit("Distributing R packages with mesos cluster is not supported.")
416413
}
417414

418415
// If we're running an R app, set the main class to our specific R runner
@@ -598,6 +595,9 @@ object SparkSubmit {
598595
if (args.pyFiles != null) {
599596
sysProps("spark.submit.pyFiles") = args.pyFiles
600597
}
598+
} else if (args.isR) {
599+
// Second argument is main class
600+
childArgs += (args.primaryResource, "")
601601
} else {
602602
childArgs += (args.primaryResource, args.mainClass)
603603
}

0 commit comments

Comments
 (0)