This repository has been archived by the owner on Feb 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathzeppelin.sh
executable file
·111 lines (87 loc) · 2.32 KB
/
zeppelin.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env bash
# NAME
# zeppelin.sh - controls snorkel-zeppelin docker image
#
# SYNOPSIS
# zeppelin.sh [-]
#
# DESCRIPTION
# zeppelin.sh controls the zeppelin docker image in snorkel
# the script takes exactly one argument
#
# ARGUMENTS
# -h/-? | --help Displays help
# -r | --start Starts zeppelin
# -s | --stop Stops zeppelin
# -f | --refresh Refresh dependencies
function start {
echo "Starting snorkel..."
docker-compose up -d
echo
echo "========== Sqooba Snorkeling Toolset =========="
echo
echo "Zeppelin and Spark are starting ... might take some time ..."
echo
echo "Zeppelin: http://localhost:${ZEPPELIN_PORT}"
echo "Spark: http://localhost:${SPARK_UI_PORT} -- after you run your first notebook."
echo
echo "Upload your data in ${ZEPPELIN_ROOT_DIR}/data"
echo "Spark logs are stored in ${ZEPPELIN_ROOT_DIR}/logs"
echo "Your notebooks are stored in ${ZEPPELIN_ROOT_DIR}/notebooks"
echo
echo "Run $(dirname $0)/refresh.sh to update js/css/python dependencies"
echo
echo "========== Happy Snorkeling ! =========="
}
function stop {
echo "Stopping snorkel..."
docker-compose stop
echo "Snorkel stopped"
}
function refresh {
echo "Refreshing javascript dependencies"
docker exec -it zeppelinstarter_zeppelin-starter_1 install-js.sh
echo "Refreshing python dependencies"
docker exec -it zeppelinstarter_zeppelin-starter_1 install-python.sh
echo "Finished!!!"
}
function help {
echo "Usage: ${0} arg"
echo " Where arg is exactly one argument."
echo
echo "Arguments:"
echo " -h/-? | --help Displays help"
echo " -r | --start Starts zeppelin"
echo " -s | --stop Stops zeppelin "
echo " -f | --refresh Refresh dependencies"
}
if [ ! $# -eq 1 ]; then
echo "${0} takes exactly 1 argument."
help
exit 1
fi
source ./env.sh
# Parse long options
for arg in "$@"; do
shift
case "$arg" in
"--help") set -- "$@" "-h" ;;
"--start")set -- "$@" "-r" ;;
"--stop") set -- "$@" "-s" ;;
"--refresh") set -- "$@" "-f" ;;
"?") set -- "$@" "-?" ;;
*) set -- "$@" "$arg"
esac
done
# Parse short options
OPTIND=1
while getopts "fhrs?" opt; do
case "$opt" in
"h") help; exit 0 ;;
"r") start ;;
"s") stop ;;
"f") refresh ;;
"?") help exit 0 ;;
esac
done
shift $(expr $OPTIND - 1) # remove options from positional parameters