@@ -7,7 +7,7 @@ FWDIR="$(cd `dirname $0`; pwd)"
7
7
8
8
export PROJECT_HOME=" $FWDIR "
9
9
10
- export SPARKR_JAR_FILE=" $FWDIR /lib/SparkR/ sparkr-assembly-0.1.jar"
10
+ export SPARKR_JAR_FILE=" $FWDIR /sparkr-assembly-0.1.jar"
11
11
12
12
# Exit if the user hasn't set SPARK_HOME
13
13
if [ ! -f " $SPARK_HOME /bin/spark-submit" ]; then
@@ -27,12 +27,6 @@ if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
27
27
usage
28
28
fi
29
29
30
-
31
- # Add SparkR to .libPaths
32
- # If we are running an R program, only set libPaths and use Rscript
33
-
34
- export R_PROFILE_USER=" /tmp/sparkR.profile"
35
-
36
30
# Build up arguments list manually to preserve quotes and backslashes.
37
31
SUBMIT_USAGE_FUNCTION=usage
38
32
gatherSparkSubmitOpts " $@ "
@@ -53,38 +47,14 @@ NUM_APPLICATION_OPTS=${#APPLICATION_OPTS[@]}
53
47
# If a R file is provided, directly run spark-submit.
54
48
if [[ $NUM_APPLICATION_OPTS -gt 0 && " ${APPLICATION_OPTS[0]} " =~ \. R$ ]]; then
55
49
56
- cat > /tmp/sparkR.profile << EOF
57
- .First <- function() {
58
- projecHome <- Sys.getenv("PROJECT_HOME")
59
- .libPaths(c(paste(projecHome,"/lib", sep=""), .libPaths()))
60
- Sys.setenv(NOAWT=1)
61
- }
62
- EOF
63
-
64
50
primary=" ${APPLICATION_OPTS[0]} "
65
51
shift
66
52
# Set the main class to SparkRRunner and add the primary R file to --files to make sure its copied to the cluster
67
53
echo " Running $SPARK_HOME /bin/spark-submit --class edu.berkeley.cs.amplab.sparkr.SparkRRunner --files $primary ${SUBMISSION_OPTS[@]} $SPARKR_JAR_FILE $primary " " ${APPLICATION_OPTS[@]: 1} "
68
54
exec " $SPARK_HOME " /bin/spark-submit --class edu.berkeley.cs.amplab.sparkr.SparkRRunner --files " $primary " " ${SUBMISSION_OPTS[@]} " " $SPARKR_JAR_FILE " " $primary " " ${APPLICATION_OPTS[@]: 1} "
69
55
else
70
56
71
- # If we don't have an R file to run, initialize context and run R
72
- cat > /tmp/sparkR.profile << EOF
73
- .First <- function() {
74
- projecHome <- Sys.getenv("PROJECT_HOME")
75
- Sys.setenv(NOAWT=1)
76
- .libPaths(c(paste(projecHome,"/lib", sep=""), .libPaths()))
77
- require(SparkR)
78
- sc <- sparkR.init(Sys.getenv("MASTER", unset = ""))
79
- assign("sc", sc, envir=.GlobalEnv)
80
- cat("\n Welcome to SparkR!")
81
- cat("\n Spark context is available as sc\n")
82
- }
83
- EOF
84
-
85
- # Add SPARKR_JAR, main class etc. to SPARKR_SUBMIT_ARGS
86
- export SPARKR_SUBMIT_ARGS
87
-
57
+ # If we don't have an R file to run, run R shell
88
58
R
89
59
90
60
fi
0 commit comments