docs/source/working-notes/troyraen/v0.5.0/schedule-night-conductor.md

Schedule Night Conductor

Cloud Scheduler cron job -> Pub/Sub -> Cloud Function -> start VM

export GCP_PROJECT=$GOOGLE_CLOUD_PROJECT
export TESTID=v050
export SURVEY=ztf
export ZONE="us-central1-a"

Test the Pub/Sub message:

# import base64
from pgb_utils import pubsub as pgbps
survey="ztf"
testid="v050"

topic_name = f'{survey}-cue_night_conductor-{testid}'
# topic_name = 'test'
cue = b'START'
attrs = {'topic_date': 'False'}
# cue = base64.b64encode('START'.encode('utf-8'))
fut = pgbps.publish(topic_name, cue, attrs=attrs)

msg = pgbps.pull(topic_name, msg_only=False)

attrs = msg[0][0].message.attributes