forked from m-lab/mlab-vis-pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·71 lines (58 loc) · 1.78 KB
/
run.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
#!/bin/bash
# Run all parts of the pipeline with a provided end date.
# options:
# -e <YYYY-MM-DD>: end date to run pipeline to.
# -t : to do a test run (doesn't start dataflow)
usage() { echo "Usage: $0 -e <YYYY-MM-DD> [-t]" 1>&2; exit 1; }
ENDDATE=""
TEST=0
while getopts ":te:" opt; do
case $opt in
e)
ENDDATE=${OPTARG}
;;
t)
echo "Setting Test to 1" >&2
TEST=1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
if [ -z "${ENDDATE}" ]; then
usage
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DATAFLOW_DIR="${DIR}/dataflow"
JAR_BASEDIR="${DIR}/dataflow/target"
JAR_FILE="${JAR_BASEDIR}/mlab-vis-pipeline.jar"
if [ ! -f $JAR_FILE ]; then
echo "JAR File not found at: ${JAR_FILE}"
exit 1;
fi
echo "End date: ${ENDDATE}"
echo "STARTING PIPELINE"
echo "moving into dir: ${DATAFLOW_DIR}"
cd ${DATAFLOW_DIR}
echo "Running historic pipeline for DAY"
java -jar ${JAR_FILE} \
--runner=com.google.cloud.dataflow.sdk.runners.DataflowPipelineRunner \
--timePeriod="day" --project=mlab-oti --stagingLocation="gs://bocoup" \
--skipNDTRead=0 --endDate=${ENDDATE} --test=${TEST} &
echo "Running historic pipeline for HOUR"
java -jar ${JAR_FILE} \
--runner=com.google.cloud.dataflow.sdk.runners.DataflowPipelineRunner \
--timePeriod="hour" --project=mlab-oti --stagingLocation="gs://bocoup" \
--skipNDTRead=0 --endDate=${ENDDATE} --test=${TEST} &
# wait for these to complete.
wait
echo "Running Bigtable Transfer Pipeline"
java -cp ${JAR_FILE} mlab.bocoup.BigtableTransferPipeline \
--runner=com.google.cloud.dataflow.sdk.runners.DataflowPipelineRunner \
--project=mlab-oti --stagingLocation="gs://bocoup" --test=${TEST}