-
Notifications
You must be signed in to change notification settings - Fork 125
/
Copy pathzingg.sh
executable file
·66 lines (62 loc) · 1.94 KB
/
zingg.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
#!/bin/bash
ZINGG_JARS=$ZINGG_HOME/zingg-0.5.0.jar
LICENSE=zinggLicense.txt
log4j_setting="-Dlog4j2.configurationFile=file:log4j2.properties"
POSITIONAL_ARGS=() # Need to save all the arguments in the list
while [[ $# -gt 0 ]]; do
case $1 in
--properties-file)
PROPERTIES_FILE="$2"
PROPERTIES="--properties-file $PROPERTIES_FILE"
shift
shift
;;
--run)
# this option is to run a user script (python)
RUN_PYTHON_PHASE=1
PYTHON_SCRIPT="$2"
shift # past argument "run"
shift
;;
--run-databricks)
# this option is to run a user script (python)
RUN_PYTHON_DB_CONNECT_PHASE=1
PYTHON_SCRIPT_DB_CONNECT="$2"
shift # past argument "run-databricks"
shift
;;
--log)
LOG_FILE=$2
LOGGING="--files $LOG_FILE"
shift
shift
;;
*)
POSITIONAL_ARGS+=("$1") # save positional arg
shift # past argument
;;
esac
done
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
#echo $PROPERTIES
#echo $PROPERTIES_FILE
#echo $@
#echo $RUN_PYTHON_PHASE
# if it is a python phase
if [[ $RUN_PYTHON_PHASE -eq 1 ]]; then
EXECUTABLE="$PYTHON_SCRIPT"
elif [[ $RUN_PYTHON_DB_CONNECT_PHASE -eq 1 ]]; then
EXECUTABLE="$PYTHON_SCRIPT_DB_CONNECT"
else
EXECUTABLE="--class zingg.spark.client.SparkClient $ZINGG_JARS"
fi
if [[ $RUN_PYTHON_DB_CONNECT_PHASE -eq 1 ]]; then
unset SPARK_MASTER
unset SPARK_HOME
export DATABRICKS_CONNECT=Y
python $EXECUTABLE
else
# All the additional options must be added here
$SPARK_HOME/bin/spark-submit --master $SPARK_MASTER $PROPERTIES --files "./log4j2.properties" --conf spark.executor.extraJavaOptions="$log4j_setting -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+HeapDumpOnOutOfMemoryError -Xloggc:/tmp/memLog.txt -XX:+UseCompressedOops" --conf spark.driver.extraJavaOptions="$log4j_setting" $LOGGING --driver-class-path $ZINGG_JARS $EXECUTABLE $@ --email $EMAIL --license $LICENSE
fi