aboutsummaryrefslogtreecommitdiff
path: root/bin/run-example
diff options
context:
space:
mode:
authorTathagata Das <tathagata.das1565@gmail.com>2014-01-20 20:48:59 -0800
committerTathagata Das <tathagata.das1565@gmail.com>2014-01-20 20:48:59 -0800
commite0b741d07a2f710c8b9f2d7266b03cc38800ed00 (patch)
treec58fc98d83169bec2ad026f97c2ccd4c6581ee4f /bin/run-example
parent792d9084e2bc9f778a00a56fa7dcfe4084153aea (diff)
downloadspark-e0b741d07a2f710c8b9f2d7266b03cc38800ed00.tar.gz
spark-e0b741d07a2f710c8b9f2d7266b03cc38800ed00.tar.bz2
spark-e0b741d07a2f710c8b9f2d7266b03cc38800ed00.zip
Made run-example respect SPARK_JAVA_OPTS and SPARK_MEM.
Diffstat (limited to 'bin/run-example')
-rwxr-xr-xbin/run-example18
1 files changed, 16 insertions, 2 deletions
diff --git a/bin/run-example b/bin/run-example
index 2e9d51440b..a362b11a39 100755
--- a/bin/run-example
+++ b/bin/run-example
@@ -64,6 +64,10 @@ if $cygwin; then
export SPARK_EXAMPLES_JAR=`cygpath -w $SPARK_EXAMPLES_JAR`
fi
+# Set SPARK_MEM if it isn't already set since we also use it for this process
+SPARK_MEM=${SPARK_MEM:-512m}
+export SPARK_MEM
+
# Find java binary
if [ -n "${JAVA_HOME}" ]; then
RUNNER="${JAVA_HOME}/bin/java"
@@ -76,11 +80,21 @@ else
fi
fi
+# Set JAVA_OPTS to be able to load native libraries and to set heap size
+JAVA_OPTS="$SPARK_JAVA_OPTS"
+JAVA_OPTS="$JAVA_OPTS -Djava.library.path=$SPARK_LIBRARY_PATH"
+JAVA_OPTS="$JAVA_OPTS -Xms$SPARK_MEM -Xmx$SPARK_MEM"
+# Load extra JAVA_OPTS from conf/java-opts, if it exists
+if [ -e "$FWDIR/conf/java-opts" ] ; then
+ JAVA_OPTS="$JAVA_OPTS `cat $FWDIR/conf/java-opts`"
+fi
+export JAVA_OPTS
+
if [ "$SPARK_PRINT_LAUNCH_COMMAND" == "1" ]; then
echo -n "Spark Command: "
- echo "$RUNNER" -cp "$CLASSPATH" "$@"
+ echo "$RUNNER" -cp "$CLASSPATH" $JAVA_OPTS "$@"
echo "========================================"
echo
fi
-exec "$RUNNER" -cp "$CLASSPATH" "$@"
+exec "$RUNNER" -cp "$CLASSPATH" $JAVA_OPTS "$@"