forked from intel/BigDL-Tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_toree.sh
executable file
·43 lines (35 loc) · 1.43 KB
/
start_toree.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# Check environment variables
if [ -z "${BIGDL_HOME}" ]; then
echo "Please set BIGDL_HOME environment variable"
exit 1
fi
if [ -z "${SPARK_HOME}" ]; then
echo "Please set SPARK_HOME environment variable"
exit 1
fi
#setup pathes
export PYSPARK_DRIVER_PYTHON=jupyter
export PYSPARK_DRIVER_PYTHON_OPTS="notebook --notebook-dir=./ --ip=* --no-browser --NotebookApp.token=''"
export BIGDL_JAR_NAME=`ls ${BIGDL_HOME}/lib/ | grep jar-with-dependencies.jar`
export BIGDL_JAR="${BIGDL_HOME}/lib/$BIGDL_JAR_NAME"
export BIGDL_PY_ZIP_NAME=`ls ${BIGDL_HOME}/lib/ | grep python-api.zip`
export BIGDL_PY_ZIP="${BIGDL_HOME}/lib/$BIGDL_PY_ZIP_NAME"
export BIGDL_CONF=${BIGDL_HOME}/conf/spark-bigdl.conf
# Check files
if [ ! -f ${BIGDL_CONF} ]; then
echo "Cannot find ${BIGDL_CONF}"
exit 1
fi
if [ ! -f ${BIGDL_PY_ZIP} ]; then
echo "Cannot find ${BIGDL_PY_ZIP}"
exit 1
fi
if [ ! -f $BIGDL_JAR ]; then
echo "Cannot find $BIGDL_JAR"
exit 1
fi
export SPARK_OPTS="--master local[4] --driver-memory 4g --properties-file ${BIGDL_CONF} --jars ${BIGDL_JAR} --conf spark.driver.extraClassPath=${BIGDL_JAR} --conf spark.executor.extraClassPath=${BIGDL_JAR} --conf spark.sql.catalogImplementation='in-memory'"
echo 'Install toree to jupyter, this may need root privilege'
sudo jupyter toree install --spark_home=${SPARK_HOME} --spark_opts='${SPARK_OPTS}'
jupyter notebook --notebook-dir=./ --ip=* --no-browser --NotebookApp.token=''