@@ -51,7 +51,7 @@ define_GCP_resources() {
5151artifact_registry_repo=$( define_GCP_resources " ${survey} -cloud-run-services" )
5252bq_dataset=$( define_GCP_resources " ${survey} " " _" )
5353bq_table_alerts=" alerts_${versiontag} "
54- bq_table_supernnova=" SuperNNova "
54+ bq_table_supernnova=" supernnova "
5555bq_table_upsilon=" upsilon"
5656bq_table_variability=" variability"
5757gcs_broker_bucket=$( define_GCP_resources " ${PROJECT_ID} -${survey} -broker_files" )
@@ -86,10 +86,10 @@ manage_resources() {
8686 else
8787 echo " ${bq_dataset} already exists."
8888 fi
89- (cd templates && bq mk --table --time_partitioning_type=DAY " ${PROJECT_ID} :${bq_dataset} .${bq_table_alerts} " " bq_${survey} _${bq_table_alerts} _schema.json" ) || exit 5
90- (cd templates && bq mk --table " ${PROJECT_ID} :${bq_dataset} .${bq_table_supernnova} " " bq_${survey} _${bq_table_supernnova} _schema.json" ) || exit 5
91- (cd templates && bq mk --table " ${PROJECT_ID} :${bq_dataset} .${bq_table_variability} " " bq_${survey} _${bq_table_variability} _schema.json" ) || exit 5
92- (cd templates && bq mk --table " ${PROJECT_ID} :${bq_dataset} .${bq_table_upsilon} " " bq_${survey} _${bq_table_upsilon} _schema.json" ) || exit 5
89+ (cd templates && bq mk --table --clustering_fields=healpix9,healpix19,healpix29 --time_partitioning_field=kafkaPublishTimestamp -- time_partitioning_type=DAY " ${PROJECT_ID} :${bq_dataset} .${bq_table_alerts} " " bq_${survey} _${bq_table_alerts} _schema.json" ) || exit 5
90+ (cd templates && bq mk --table --time_partitioning_field=kafkaPublishTimestamp --time_partitioning_type=DAY " ${PROJECT_ID} :${bq_dataset} .${bq_table_supernnova} " " bq_${survey} _${bq_table_supernnova} _schema.json" ) || exit 5
91+ (cd templates && bq mk --table --time_partitioning_field=kafkaPublishTimestamp --time_partitioning_type=DAY " ${PROJECT_ID} :${bq_dataset} .${bq_table_variability} " " bq_${survey} _${bq_table_variability} _schema.json" ) || exit 5
92+ (cd templates && bq mk --table --time_partitioning_field=kafkaPublishTimestamp --time_partitioning_type=DAY " ${PROJECT_ID} :${bq_dataset} .${bq_table_upsilon} " " bq_${survey} _${bq_table_upsilon} _schema.json" ) || exit 5
9393 bq update --description " Alert data from LSST. This table is an archive of the lsst-alerts Pub/Sub stream. It has the same schema as the original alert bytes, including nested and repeated fields." " ${PROJECT_ID} :${bq_dataset} .${bq_table_alerts} "
9494 bq update --description " Binary classification results from SuperNNova." " ${PROJECT_ID} :${bq_dataset} .${bq_table_supernnova} "
9595
@@ -143,14 +143,21 @@ manage_resources() {
143143 --dead-letter-topic=" ${ps_deadletter_topic} " \
144144 --max-delivery-attempts=5 \
145145 --dead-letter-topic-project=" ${PROJECT_ID} " \
146- --message-filter=' attributes.schema_version = "' " ${versiontag} " ' "'
146+ --message-filter=' attributes.schema_version = "' " ${versiontag} " ' "' \
147+ --message-transforms-file=templates/ps_lsst_add_top_level_fields_smt.yaml
147148 # set IAM policies on public Pub/Sub resources
148149 if [ " $testid " = " False" ]; then
149150 user=" allUsers"
150- roleid=" projects/ ${GOOGLE_CLOUD_PROJECT} / roles/userPublic "
151+ roleid=" roles/pubsub.subscriber "
151152 gcloud pubsub topics add-iam-policy-binding " ${ps_topic_alerts} " --member=" ${user} " --role=" ${roleid} "
152153 gcloud pubsub topics add-iam-policy-binding " ${ps_topic_alerts_json} " --member=" ${user} " --role=" ${roleid} "
153154 gcloud pubsub topics add-iam-policy-binding " ${ps_topic_alerts_lite} " --member=" ${user} " --role=" ${roleid} "
155+ gcloud pubsub topics add-iam-policy-binding " ${ps_deadletter_topic} " \
156+ --member=" serviceAccount:${service_account} " \
157+ --role=" roles/pubsub.publisher"
158+ gcloud pubsub subscriptions add-iam-policy-binding " ${ps_bigquery_subscription} " \
159+ --member=" serviceAccount:${service_account} " \
160+ --role=" roles/pubsub.subscriber"
154161 fi
155162
156163 # --- Create Artifact Registry Repository
0 commit comments