-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_pipeline.sh
executable file
·61 lines (46 loc) · 2.54 KB
/
run_pipeline.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
#!/usr/bin/env bash
set -e
if [[ $# -ne 7 ]]; then
echo "Usage: ./run_pipeline.sh"
echo "<user> <pipeline-name> <google-cloud-credentials-file-path> <configuration-file> <code-schemes-dir> <data-dir> <archive-dir>"
echo "Runs the pipeline end-to-end (sync-rapid-pro-to-engagement-db, sync-engagement-db-to-coda, sync-coda-to-engagement-db,\
sync-engagement-db-to-rapid-pro, run-engagement-db-to-analysis, ARCHIVE)"
exit
fi
USER=$1
PIPELINE_NAME=$2
GOOGLE_CLOUD_CREDENTIALS_PATH=$3
CONFIGURATION_FILE=$4
CODE_SCHEMES_DIR=$5
DATA_DIR=$6
ARCHIVE_DIR=$7
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
HASH=$(git rev-parse HEAD)
RUN_ID="$DATE-$HASH"
ARCHIVE_FILE="$ARCHIVE_DIR/data-$RUN_ID.tar.gzip"
echo "Starting a new pipeline run with id ${RUN_ID}"
./docker-run-log-pipeline-event.sh \
"$CONFIGURATION_FILE" "$CODE_SCHEMES_DIR" "$GOOGLE_CLOUD_CREDENTIALS_PATH" "$RUN_ID" "PipelineRunStart"
./docker-run-kobotoolbox-to-engagement-db.sh \
--incremental-cache-volume "$PIPELINE_NAME-kobotoolbox-to-engagement-db-cache" \
"$USER" "$GOOGLE_CLOUD_CREDENTIALS_PATH" "$CONFIGURATION_FILE" "$CODE_SCHEMES_DIR" "$DATA_DIR"
./docker-sync-rapid-pro-to-engagement-db.sh \
--incremental-cache-volume "$PIPELINE_NAME-rapid-pro-to-engagement-db-cache" \
"$USER" "$GOOGLE_CLOUD_CREDENTIALS_PATH" "$CONFIGURATION_FILE" "$CODE_SCHEMES_DIR" "$DATA_DIR"
./docker-sync-engagement-db-to-coda.sh \
--incremental-cache-volume "$PIPELINE_NAME-engagement-db-to-coda-cache" \
"$USER" "$GOOGLE_CLOUD_CREDENTIALS_PATH" "$CONFIGURATION_FILE" "$CODE_SCHEMES_DIR" "$DATA_DIR"
./docker-sync-coda-to-engagement-db.sh \
--incremental-cache-volume "$PIPELINE_NAME-coda-to-engagement-db-cache" \
"$USER" "$GOOGLE_CLOUD_CREDENTIALS_PATH" "$CONFIGURATION_FILE" "$CODE_SCHEMES_DIR" "$DATA_DIR"
./docker-sync-engagement-db-to-rapid-pro.sh \
--incremental-cache-volume "$PIPELINE_NAME-engagement-db-to-rapid-pro-cache" \
"$USER" "$GOOGLE_CLOUD_CREDENTIALS_PATH" "$CONFIGURATION_FILE" "$CODE_SCHEMES_DIR"
./docker-run-engagement-db-to-analysis.sh \
--incremental-cache-volume "$PIPELINE_NAME-engagement-db-to-analysis-cache" \
"$USER" "$GOOGLE_CLOUD_CREDENTIALS_PATH" "$CONFIGURATION_FILE" "$CODE_SCHEMES_DIR" "$DATA_DIR"
./archive_data_dir.sh "$DATA_DIR" "$ARCHIVE_FILE"
./docker-run-upload-archive-files.sh \
"$USER" "$GOOGLE_CLOUD_CREDENTIALS_PATH" "$CONFIGURATION_FILE" "$CODE_SCHEMES_DIR" "$ARCHIVE_DIR"
./docker-run-log-pipeline-event.sh \
"$CONFIGURATION_FILE" "$CODE_SCHEMES_DIR" "$GOOGLE_CLOUD_CREDENTIALS_PATH" "$RUN_ID" "PipelineRunEnd"