3939# --- GCP resources used directly in this script
4040broker_bucket=" ${PROJECT_ID} -${survey} -broker_files"
4141bq_dataset=" ${survey} "
42+ topic_deadletter=" ${survey} -deadletter"
43+ subscription_deadletter=" ${survey} -deadletter"
44+ subscription_storebigquery=" ${survey} -bigquery"
45+
4246# use test resources, if requested
4347# (there must be a better way to do this)
4448if [ " $testid " != " False" ]; then
4549 broker_bucket=" ${broker_bucket} -${testid} "
4650 bq_dataset=" ${bq_dataset} _${testid} "
51+ topic_deadletter=" ${topic_deadletter} -${testid} "
52+ subscription_storebigquery=" ${subscription_storebigquery} -${testid} "
53+ subscription_deadletter=" ${subscription_deadletter} -${testid} "
4754fi
4855
56+ alerts_table=" alerts_${versiontag} "
4957
5058# --- Create (or delete) BigQuery, GCS, Pub/Sub resources
5159echo
@@ -54,13 +62,36 @@ if [ "$testid" != "False" ]; then
5462 if [ " $teardown " = " True" ]; then
5563 # delete testing resources
5664 python3 setup_gcp.py --survey=" $survey " --testid=" $testid " --teardown --confirmed --versiontag=" ${versiontag} "
65+ gcloud pubsub topics delete " ${topic_deadletter} "
66+ gcloud pubsub subscriptions delete " ${subscription_deadletter} "
67+ gcloud pubsub subscriptions delete " ${subscription_storebigquery} "
5768 else
5869 # setup testing resources
5970 python3 setup_gcp.py --survey=" $survey " --testid=" $testid " --confirmed --region=" ${region} " --versiontag=" ${versiontag} "
71+ gcloud pubsub topics create " ${topic_deadletter} "
72+ gcloud pubsub subscriptions create " ${subscription_deadletter} " --topic=" ${topic_deadletter} "
73+ gcloud pubsub subscriptions create " ${subscription_storebigquery} " \
74+ --topic=" ${topic_alerts} " \
75+ --bigquery-table=" ${PROJECT_ID} :${bq_dataset} .${alerts_table} " \
76+ --use-table-schema \
77+ --drop-unknown-fields \
78+ --dead-letter-topic=" ${topic_deadletter} " \
79+ --max-delivery-attempts=5 \
80+ --dead-letter-topic-project=" ${PROJECT_ID} "
6081 fi
6182else
6283 # setup production resources
6384 python3 setup_gcp.py --survey=" $survey " --production --confirmed --region=" ${region} "
85+ gcloud pubsub topics create " ${topic_deadletter} "
86+ gcloud pubsub subscriptions create " ${subscription_deadletter} " --topic=" ${topic_deadletter} "
87+ gcloud pubsub subscriptions create " ${subscription_storebigquery} " \
88+ --topic=" ${topic_alerts} " \
89+ --bigquery-table=" ${PROJECT_ID} :${bq_dataset} .${alerts_table} " \
90+ --use-table-schema \
91+ --drop-unknown-fields \
92+ --dead-letter-topic=" ${topic_deadletter} " \
93+ --max-delivery-attempts=5 \
94+ --dead-letter-topic-project=" ${PROJECT_ID} "
6495fi
6596
6697
@@ -126,10 +157,6 @@ cd .. && cd lite || exit
126157cd .. && cd ps_to_gcs || exit
127158./deploy.sh " $testid " " $teardown " " $survey " " $versiontag " " $region "
128159
129- # --- BigQuery storage cloud function
130- cd .. && cd store_BigQuery || exit
131- ./deploy.sh " $testid " " $teardown " " $survey " " $versiontag "
132-
133160# --- tag alerts cloud function
134161cd .. && cd tag || exit
135162./deploy.sh " $testid " " $teardown " " $survey " " $versiontag "
0 commit comments