Skip to content

Commit 86fc639

Browse files
committed
Move sparkR-submit into pkg/inst
1 parent 95ee6b4 commit 86fc639

File tree

1 file changed

+2
-32
lines changed

1 file changed

+2
-32
lines changed

sparkR-submit renamed to pkg/inst/sparkR-submit

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ FWDIR="$(cd `dirname $0`; pwd)"
77

88
export PROJECT_HOME="$FWDIR"
99

10-
export SPARKR_JAR_FILE="$FWDIR/lib/SparkR/sparkr-assembly-0.1.jar"
10+
export SPARKR_JAR_FILE="$FWDIR/sparkr-assembly-0.1.jar"
1111

1212
# Exit if the user hasn't set SPARK_HOME
1313
if [ ! -f "$SPARK_HOME/bin/spark-submit" ]; then
@@ -27,12 +27,6 @@ if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
2727
usage
2828
fi
2929

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-
3630
# Build up arguments list manually to preserve quotes and backslashes.
3731
SUBMIT_USAGE_FUNCTION=usage
3832
gatherSparkSubmitOpts "$@"
@@ -53,38 +47,14 @@ NUM_APPLICATION_OPTS=${#APPLICATION_OPTS[@]}
5347
# If a R file is provided, directly run spark-submit.
5448
if [[ $NUM_APPLICATION_OPTS -gt 0 && "${APPLICATION_OPTS[0]}" =~ \.R$ ]]; then
5549

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-
6450
primary="${APPLICATION_OPTS[0]}"
6551
shift
6652
# Set the main class to SparkRRunner and add the primary R file to --files to make sure its copied to the cluster
6753
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}"
6854
exec "$SPARK_HOME"/bin/spark-submit --class edu.berkeley.cs.amplab.sparkr.SparkRRunner --files "$primary" "${SUBMISSION_OPTS[@]}" "$SPARKR_JAR_FILE" "$primary" "${APPLICATION_OPTS[@]:1}"
6955
else
7056

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
8858
R
8959

9060
fi

0 commit comments

Comments
 (0)