forked from intel-analytics/BigDL-Tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
toree_install.sh
executable file
·70 lines (57 loc) · 2.46 KB
/
toree_install.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# Required BigDL and Spark version
export BIGDL_VERSION=0.7.0
export SPARK_VERSION=2.2.1
# Find the path of BigDL and Spark
export BIGDL_PIP_HOME=`pip show BigDL | sed -n -e '/^Location/p' | sed 's/[^ ]* //'`
export BIGDL_HOME=${BIGDL_PIP_HOME}/bigdl/share
export PYSPARK_PIP_HOME=`pip show pyspark | sed -n -e '/^Location/p' | sed 's/[^ ]* //'`
export SPARK_HOME=${PYSPARK_PIP_HOME}/pyspark
function version_gt() {
test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1";
}
# Check installation of BigDL
if [ -z "${BIGDL_HOME}" ]; then
echo "Cannot find BigDL installation directory. Have you run 'pip install BigDL==${BIGDL_VERSION}'?"
exit 1
fi
# Check installation of Spark
if [ -z "${SPARK_HOME}" ]; then
echo "Cannot find Spark installation directory. Have you run 'pip install BigDL==${BIGDL_VERSION}'?"
exit 1
fi
# Check the version BigDL and Spark
export BIGDL_TEMP_VERSION=`pip show BigDL | sed -n -e '/^Version/p' | sed 's/[^ ]* //'`
if [ "${BIGDL_VERSION}" != "${BIGDL_TEMP_VERSION}" ]; then
echo "Wrong version of BigDL=${BIGDL_TEMP_VERSION}. Please run 'pip install BigDL==${BIGDL_VERSION}'."
exit 1
fi
export SPARK_TEMP_VERSION=`pip show pyspark | sed -n -e '/^Version/p' | sed 's/[^ ]* //'`
if version_gt "${SPARK_VERSION}" "${SPARK_TEMP_VERSION}" ; then
echo "Wrong version of Spark=${SPARK_TEMP_VERSION}. Expect ${SPARK_VERSION}. Please run 'pip install BigDL==${BIGDL_VERSION}' or 'pip install pyspark==${SPARK_VERSION}'."
exit 1
fi
# Set paths
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_JAR} ]; then
echo "Cannot find ${BIGDL_JAR}!"
exit 1
fi
if [ ! -f ${BIGDL_PY_ZIP} ]; then
echo "Cannot find ${BIGDL_PY_ZIP}!"
exit 1
fi
if [ ! -f ${BIGDL_CONF} ]; then
echo "Cannot find ${BIGDL_CONF}!"
exit 1
fi
# Configure Spark
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'"
# Install Toree
echo "Install Toree"
jupyter toree install --interpreters=Scala,PySpark --spark_home=${SPARK_HOME} --spark_opts="${SPARK_OPTS}" --user