forked from aehrc/VariantSpark
-
Notifications
You must be signed in to change notification settings - Fork 1
/
variant-spark
executable file
·58 lines (50 loc) · 1.67 KB
/
variant-spark
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
#!/bin/bash
PWD=$(cd `dirname "$0"`; pwd)
if [[ -z "${VARIANT_SPARK_HOME}" ]]; then
VARIANT_SPARK_HOME="${PWD}"
fi
if [[ -n "${VS_ECHO_CMDLINE}" ]]; then
echo "$0" "$@"
fi
if [[ -d "${VARIANT_SPARK_HOME}/lib" ]]; then
VS_ASSEMBLY_DIR="${VARIANT_SPARK_HOME}/lib"
else
VS_ASSEMBLY_DIR="${VARIANT_SPARK_HOME}/target"
fi
VS_ASSEMBLY_JAR=$(echo ${VS_ASSEMBLY_DIR}/variant-spark_*-all.jar)
RUNNER="--spark"
declare -a SPARK_PARAMS
spark_param_index=0
if [[ "$1" == "--spark" || "$1" == "--emr" || "$1" == "--local" ]]; then
RUNNER="$1"
shift 1
while [[ "$#" -gt 0 ]]; do
arg="$1"
shift 1
if [[ "$arg" == "--" ]]; then
break
fi
SPARK_PARAMS[spark_param_index]="$arg"
((spark_param_index+=1))
done
fi
if [[ -n "${VS_DEBUG}" ]]; then
echo "Home: ${VARIANT_SPARK_HOME} "
echo "Runner: ${RUNNER}"
echo "Jar: ${VS_ASSEMBLY_JAR}"
fi
if [[ "${RUNNER}" == "--spark" ]]; then
spark-submit --class au.csiro.variantspark.cli.VariantSparkApp \
--driver-class-path ${VARIANT_SPARK_HOME}/conf \
"${SPARK_PARAMS[@]}" \
${VS_ASSEMBLY_JAR} "$@"
elif [[ "${RUNNER}" == "--emr" ]]; then
spark-submit --class au.csiro.variantspark.cli.VariantSparkApp \
"${SPARK_PARAMS[@]}" \
${VS_ASSEMBLY_JAR} "$@"
else
SPARK_JARS="${SPARK_HOME}/jars/*"
SPARK_CLASSPATH="${VARIANT_SPARK_HOME}/conf:${VS_ASSEMBLY_JAR}:${SPARK_JARS}:/usr/lib/hadoop/lib/*:/usr/lib/hadoop/.//*:/usr/lib/hadoop-hdfs/./:/usr/lib/hadoop-hdfs/lib/*:/usr/lib/hadoop-hdfs/.//*:/usr/lib/hadoop-yarn/lib/*:/usr/lib/hadoop-yarn/.//*:/usr/lib/hadoop-mapreduce/lib/*:/usr/lib/hadoop-mapreduce/.//*"
echo "$SPARK_CLASSPATH"
java -cp "${SPARK_CLASSPATH}" "${SPARK_PARAMS[@]}" au.csiro.variantspark.cli.VariantSparkApp "$@"
fi