2010-03-30 03:17:55 +04:00
|
|
|
#!/bin/bash
|
|
|
|
|
2011-09-27 01:44:41 +04:00
|
|
|
SCALA_VERSION=2.9.1
|
2011-05-27 13:20:34 +04:00
|
|
|
|
2010-03-30 03:17:55 +04:00
|
|
|
# Figure out where the Scala framework is installed
|
2010-10-16 23:18:02 +04:00
|
|
|
FWDIR="$(cd `dirname $0`; pwd)"
|
2010-03-30 03:17:55 +04:00
|
|
|
|
2010-10-16 06:42:26 +04:00
|
|
|
# Export this as SPARK_HOME
|
|
|
|
export SPARK_HOME="$FWDIR"
|
|
|
|
|
2010-07-20 05:00:30 +04:00
|
|
|
# Load environment variables from conf/spark-env.sh, if it exists
|
|
|
|
if [ -e $FWDIR/conf/spark-env.sh ] ; then
|
|
|
|
. $FWDIR/conf/spark-env.sh
|
|
|
|
fi
|
|
|
|
|
2010-10-16 06:42:26 +04:00
|
|
|
MESOS_CLASSPATH=""
|
|
|
|
MESOS_LIBRARY_PATH=""
|
|
|
|
|
2010-08-13 11:39:36 +04:00
|
|
|
if [ "x$MESOS_HOME" != "x" ] ; then
|
2010-10-16 06:42:26 +04:00
|
|
|
MESOS_CLASSPATH="$MESOS_HOME/lib/java/mesos.jar"
|
|
|
|
MESOS_LIBRARY_PATH="$MESOS_HOME/lib/java"
|
2010-08-13 11:39:36 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "x$SPARK_MEM" == "x" ] ; then
|
2011-08-02 00:54:48 +04:00
|
|
|
SPARK_MEM="512m"
|
2010-07-20 05:00:30 +04:00
|
|
|
fi
|
2011-08-02 00:54:48 +04:00
|
|
|
export SPARK_MEM # So that the process sees it and can report it to Mesos
|
2010-07-20 05:00:30 +04:00
|
|
|
|
|
|
|
# Set JAVA_OPTS to be able to load native libraries and to set heap size
|
|
|
|
JAVA_OPTS="$SPARK_JAVA_OPTS"
|
2010-11-14 09:46:00 +03:00
|
|
|
JAVA_OPTS+=" -Djava.library.path=$SPARK_LIBRARY_PATH:$FWDIR/lib:$FWDIR/src/main/native:$MESOS_LIBRARY_PATH"
|
2010-07-20 05:00:30 +04:00
|
|
|
JAVA_OPTS+=" -Xms$SPARK_MEM -Xmx$SPARK_MEM"
|
|
|
|
# Load extra JAVA_OPTS from conf/java-opts, if it exists
|
2010-03-30 03:17:55 +04:00
|
|
|
if [ -e $FWDIR/conf/java-opts ] ; then
|
|
|
|
JAVA_OPTS+=" `cat $FWDIR/conf/java-opts`"
|
|
|
|
fi
|
|
|
|
export JAVA_OPTS
|
|
|
|
|
2011-02-02 02:11:08 +03:00
|
|
|
CORE_DIR=$FWDIR/core
|
2011-05-27 13:20:34 +04:00
|
|
|
REPL_DIR=$FWDIR/repl
|
2011-02-02 02:11:08 +03:00
|
|
|
EXAMPLES_DIR=$FWDIR/examples
|
2011-04-14 01:59:19 +04:00
|
|
|
BAGEL_DIR=$FWDIR/bagel
|
2011-02-02 02:11:08 +03:00
|
|
|
|
|
|
|
# Build up classpath
|
2011-07-15 06:38:25 +04:00
|
|
|
CLASSPATH="$SPARK_CLASSPATH:$CORE_DIR/target/scala-$SCALA_VERSION/classes:$MESOS_CLASSPATH"
|
2010-09-29 10:22:07 +04:00
|
|
|
CLASSPATH+=:$FWDIR/conf
|
2011-07-15 06:38:25 +04:00
|
|
|
CLASSPATH+=:$REPL_DIR/target/scala-$SCALA_VERSION/classes
|
|
|
|
CLASSPATH+=:$EXAMPLES_DIR/target/scala-$SCALA_VERSION/classes
|
2011-05-27 13:20:34 +04:00
|
|
|
for jar in `find $CORE_DIR/lib -name '*jar'`; do
|
|
|
|
CLASSPATH+=:$jar
|
|
|
|
done
|
2011-07-15 06:38:25 +04:00
|
|
|
for jar in `find $FWDIR/lib_managed/jars -name '*jar'`; do
|
2011-05-27 13:20:34 +04:00
|
|
|
CLASSPATH+=:$jar
|
|
|
|
done
|
2011-07-15 06:38:25 +04:00
|
|
|
for jar in `find $FWDIR/lib_managed/bundles -name '*jar'`; do
|
2011-05-27 13:20:34 +04:00
|
|
|
CLASSPATH+=:$jar
|
|
|
|
done
|
2011-07-15 06:38:25 +04:00
|
|
|
for jar in `find $REPL_DIR/lib -name '*jar'`; do
|
2010-09-29 10:22:07 +04:00
|
|
|
CLASSPATH+=:$jar
|
2010-03-30 03:17:55 +04:00
|
|
|
done
|
2011-07-15 06:38:25 +04:00
|
|
|
CLASSPATH+=:$BAGEL_DIR/target/scala-$SCALA_VERSION/classes
|
2010-09-29 10:22:07 +04:00
|
|
|
export CLASSPATH # Needed for spark-shell
|
2010-03-30 03:17:55 +04:00
|
|
|
|
|
|
|
if [ -n "$SCALA_HOME" ]; then
|
|
|
|
SCALA=${SCALA_HOME}/bin/scala
|
|
|
|
else
|
|
|
|
SCALA=scala
|
|
|
|
fi
|
|
|
|
|
2011-06-01 09:17:48 +04:00
|
|
|
exec $SCALA -cp $CLASSPATH "$@"
|