Add script to post alerts to CoMapeo Cloud API #60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal
Closes #28.
Note
This code will not yet work in production, because it depends on digidem/comapeo-cloud#41 being merged and a new CoMapeo Docker image being published and deployed.
What I changed
comapeo_alerts
script that performs the following tasks:Notes
In implementing this, I sought fit to turn this into its own script apart from
alerts_gcs
to maintain clean code and ensure separation of concerns.However, this approach introduces a sequence issue: when scheduled in production, this script should run after
alerts_gcs
has successfully ingested a new batch of alerts. While we can make a reasonable estimate of when to schedule this based on existingalerts_gcs
run data across our Windmill instances, this approach is not deterministic and could encounter edge cases where analerts_gcs
run takes significantly longer than expected due to issues with GCP upstream.This is further complicated by the fact we have a third operation in the sequence: #59 aims to send a Twilio message to recipients about new alerts. #59 adds this operation to the
alerts_gcs
script, but arguably, a message to recipients about new alerts should not be sent until both scripts have run: a CoMapeo user in the field can then know to synchronize, to see the new alerts on CoMapeo right away.This leads me to think there are two options:
main
function, but are imported into one that does.Opinions welcome.