aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorPatrick Wendell <pwendell@gmail.com>2014-01-20 23:34:35 -0800
committerPatrick Wendell <pwendell@gmail.com>2014-01-20 23:34:35 -0800
commitc67d3d8beb101fff2ea6397b759dd1bfdf9fcfa5 (patch)
tree99b253ab737c4dcc9a09fd9907cb41b82c6595f1 /bin
parent6b4eed779bd1889543ac2c058745bd0864f02b2a (diff)
parent65869f843d5eb2b9b686d07aadaa7f1a0f16e8c7 (diff)
downloadspark-c67d3d8beb101fff2ea6397b759dd1bfdf9fcfa5.tar.gz
spark-c67d3d8beb101fff2ea6397b759dd1bfdf9fcfa5.tar.bz2
spark-c67d3d8beb101fff2ea6397b759dd1bfdf9fcfa5.zip
Merge pull request #484 from tdas/run-example-fix
Made run-example respect SPARK_JAVA_OPTS and SPARK_MEM. bin/run-example scripts was not passing Java properties set through the SPARK_JAVA_OPTS to the example. This is important for examples like Twitter** as the Twitter authentication information must be set through java properties. Hence added the same JAVA_OPTS code in run-example as it is in bin/spark-class script. Also added SPARK_MEM, in case someone wants to run the example with different amounts of memory. This can be removed if it is not tune with the intended semantics of the run-example scripts. @matei Please check this soon I want this to go in 0.9-rc4
Diffstat (limited to 'bin')
-rwxr-xr-xbin/run-example13
1 files changed, 11 insertions, 2 deletions
diff --git a/bin/run-example b/bin/run-example
index 2e9d51440b..adba7dd97a 100755
--- a/bin/run-example
+++ b/bin/run-example
@@ -76,11 +76,20 @@ 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"
+# 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 "$@"