aboutsummaryrefslogtreecommitdiff
path: root/bin/run-example
diff options
context:
space:
mode:
authorMatei Zaharia <matei@databricks.com>2014-05-19 15:02:35 -0700
committerTathagata Das <tathagata.das1565@gmail.com>2014-05-19 15:02:52 -0700
commit111c121ae97730fa8d87db7f0d17e10879fa76ab (patch)
tree8bfdcace34ab9d4884f9477be654982c5a94a2ba /bin/run-example
parentecab8a239dcbb889181c572317581d1c8b627201 (diff)
downloadspark-111c121ae97730fa8d87db7f0d17e10879fa76ab.tar.gz
spark-111c121ae97730fa8d87db7f0d17e10879fa76ab.tar.bz2
spark-111c121ae97730fa8d87db7f0d17e10879fa76ab.zip
[SPARK-1876] Windows fixes to deal with latest distribution layout changes
- Look for JARs in the right place - Launch examples the same way as on Unix - Load datanucleus JARs if they exist - Don't attempt to parse local paths as URIs in SparkSubmit, since paths with C:\ are not valid URIs - Also fixed POM exclusion rules for datanucleus (it wasn't properly excluding it, whereas SBT was) Author: Matei Zaharia <matei@databricks.com> Closes #819 from mateiz/win-fixes and squashes the following commits: d558f96 [Matei Zaharia] Fix comment 228577b [Matei Zaharia] Review comments d3b71c7 [Matei Zaharia] Properly exclude datanucleus files in Maven assembly 144af84 [Matei Zaharia] Update Windows scripts to match latest binary package layout (cherry picked from commit 7b70a7071894dd90ea1d0091542b3e13e7ef8d3a) Signed-off-by: Tathagata Das <tathagata.das1565@gmail.com>
Diffstat (limited to 'bin/run-example')
-rwxr-xr-xbin/run-example23
1 files changed, 11 insertions, 12 deletions
diff --git a/bin/run-example b/bin/run-example
index 146951ac0e..7caab31dae 100755
--- a/bin/run-example
+++ b/bin/run-example
@@ -23,6 +23,16 @@ FWDIR="$(cd `dirname $0`/..; pwd)"
export SPARK_HOME="$FWDIR"
EXAMPLES_DIR="$FWDIR"/examples
+if [ -n "$1" ]; then
+ EXAMPLE_CLASS="$1"
+ shift
+else
+ echo "Usage: ./bin/run-example <example-class> [example-args]"
+ echo " - set MASTER=XX to use a specific master"
+ echo " - can use abbreviated example class name (e.g. SparkPi, mllib.LinearRegression)"
+ exit 1
+fi
+
if [ -f "$FWDIR/RELEASE" ]; then
export SPARK_EXAMPLES_JAR=`ls "$FWDIR"/lib/spark-examples-*hadoop*.jar`
elif [ -e "$EXAMPLES_DIR"/target/scala-$SCALA_VERSION/spark-examples-*hadoop*.jar ]; then
@@ -37,17 +47,6 @@ fi
EXAMPLE_MASTER=${MASTER:-"local[*]"}
-if [ -n "$1" ]; then
- EXAMPLE_CLASS="$1"
- shift
-else
- echo "usage: ./bin/run-example <example-class> [example-args]"
- echo " - set MASTER=XX to use a specific master"
- echo " - can use abbreviated example class name (e.g. SparkPi, mllib.MovieLensALS)"
- echo
- exit -1
-fi
-
if [[ ! $EXAMPLE_CLASS == org.apache.spark.examples* ]]; then
EXAMPLE_CLASS="org.apache.spark.examples.$EXAMPLE_CLASS"
fi
@@ -55,5 +54,5 @@ fi
./bin/spark-submit \
--master $EXAMPLE_MASTER \
--class $EXAMPLE_CLASS \
- $SPARK_EXAMPLES_JAR \
+ "$SPARK_EXAMPLES_JAR" \
"$@"