Unify dispatch of LVAlert and GCN messages using decorators
GCN notice handlers are declared like this:
import lxml.etree
from gwcelery.tasks import gcn
@gcn.handler(gcn.NoticeType.FERMI_GBM_GND_POS,
gcn.NoticeType.FERMI_GBM_FIN_POS)
def handle_fermi(payload):
root = lxml.etree.fromstring(payload)
# do work here...
LVAlert message handlers are declared like this:
import json
from gwcelery.tasks import lvalert
@lvalert.handler('cbc_gstlal',
'cbc_pycbc',
'cbc_mbta')
def handle_cbc(alert_content):
alert = json.loads(alert_content)
# do work here...
Edited by Leo P. Singer