Skip to content

Copy alert dictionary before modifying contents to send Kafka alert notices

Cody Messick requested to merge cody.messick/gwcelery:alert_dict_skymap into main

I realized when writing a task to upload the alert dictionary to gracedb (MR incoming after this) that currently the alert dictionary is being modified in place to add the encoded skymap contents. That's possibly okay at the moment because we're using a solo pool, but could cause problems once we start sending the kafka alerts in parallel (see #450).

To get around this, the _send function now makes a shallow copy of the alert dictionary at the start, and then makes a shallow copy of the event dictionary if there is one. This copied dictionary is then used to send the alert instead of the input. Since it's just shallow copies, all versions of the alert dictionary across the send tasks will contain a reference to the same external coinc dictionary, but we don't modify that after creation so it doesn't matter.

Merge request reports