Skip to content
Snippets Groups Projects
Commit f1f73293 authored by Cody Messick's avatar Cody Messick
Browse files

Fix style issues

parent b2e14f5e
No related branches found
No related tags found
No related merge requests found
......@@ -8,14 +8,17 @@ import voeventparse
# FIXME Figure out where this will live
parsed_schema = fastavro.schema.load_schema('/home/emfollow-test/.avro_avsc_files_test_deleteme/igwn.alerts.v1_0.Alert.avsc')
@gracedb.task(shared=False)
def _create_alert_payload(superevent_id):
skymap_bytes = gracedb.download.s('bayestar.multiorder.fits', superevent_id)()
skymap_bytes = gracedb.download.s(
'bayestar.multiorder.fits',
superevent_id
)()
# FIXME Add check to ensure skymap downloaded correctly
return skymap_bytes
def _create_alert_dict(message, raven_coinc=False):
# FIXME Update to extract information from igwn alert instead of voevent
......@@ -23,7 +26,8 @@ def _create_alert_dict(message, raven_coinc=False):
voevent = voeventparse.voevent.loads(message)
params = {elem.attrib['name']: elem.attrib['value'] for elem in voevent.iterfind('.//Param')}
params = {elem.attrib['name']: elem.attrib['value'] for elem in
voevent.iterfind('.//Param')}
# the voevent object returns lxml.objectify.StringElement objects for
# fields that contain strings, need to convert this to a string for the
# avro writer
......@@ -36,7 +40,6 @@ def _create_alert_dict(message, raven_coinc=False):
# FIXME Do we need to check for software injections?
alert_dict['is_injection'] = bool(params['HardwareInj'])
alert_dict['urls'] = {'gracedb': params['EventPage']}
# FIXME Track this ourselves when we move the voevent generation out of gracedb
alert_dict['event_revision'] = int(params['Pkt_Ser_Num'])
if alert_dict['alert_type'] == 'RETRACTION':
......@@ -45,7 +48,7 @@ def _create_alert_dict(message, raven_coinc=False):
# FIXME Is there a better way to check for a skymap without querying
# gracedb?
if 'skymap_fits' in params:
skymap = _create_alert_payload(alert_dict['superevent_id'])
skymap = _create_alert_payload(alert_dict['superevent_id'])
else:
skymap = None
alert_dict['event'] = {
......@@ -67,7 +70,6 @@ def _create_alert_dict(message, raven_coinc=False):
'skymap': skymap
}
if raven_coinc:
alert_dict['external_coinc'] = {
'gcn_notice_id': params['External_GCN_Notice_Id'],
......@@ -76,7 +78,8 @@ def _create_alert_dict(message, raven_coinc=False):
'search': params['External_Search'],
'time_difference': params['Time_Difference'],
'time_coincidence_far': params.get(['Time_Coincidence_FAR']),
'time_sky_position_coincidence_far': params.get(['Time_Sky_Position_Coincidence_FAR'])
'time_sky_position_coincidence_far':
params.get(['Time_Sky_Position_Coincidence_FAR'])
}
else:
# FIXME Currently this logic will cause the task to silently ignore
......@@ -85,6 +88,7 @@ def _create_alert_dict(message, raven_coinc=False):
return alert_dict
@app.task(bind=True, default_retry_delay=20.0,
ignore_result=True, queue='kafka', retry_backoff=True,
retry_kwargs=dict(max_retries=10), shared=False)
......
......@@ -762,7 +762,8 @@ def preliminary_initial_update_alert(filenames, superevent_id, alert_type,
if alert_type in {'earlywarning', 'preliminary'}
else identity.si()
),
# FIXME Create label like GCN_PRELIM_SENT on gracedb that can be set here
# FIXME Create label like GCN_PRELIM_SENT on gracedb that can
# be set here
avro.send.s(raven_coinc=('RAVEN_ALERT' in labels))
),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment