Skip to content
Snippets Groups Projects
Commit 46838b79 authored by Brandon Piotrzkowski's avatar Brandon Piotrzkowski
Browse files

Update SNEWS GCN ingestion to use canvas structure; fixes #449

parent 37e20e44
No related branches found
No related tags found
1 merge request!918Update SNEWS GCN ingestion to use canvas structure; fixes #449
......@@ -8,6 +8,9 @@ Changelog
- Fix bug where updated GRB events couldn't create sky maps.
- Update SNEWS ingestion to use canvas structure. This also fixes a bug
where SNEWS tests events were not being ingested properly.
- Fix datetime format in Avro and JSON notices so that they conform to
ISO 8601. They were missing the ``T`` separating the date from the time
and the final ``Z`` denoting the UTC time zone.
......
......@@ -56,18 +56,16 @@ def handle_snews_gcn(payload):
assert len(events) == 1, 'Found more than one matching GraceDB entry'
event, = events
graceid = event['graceid']
gracedb.replace_event(graceid, payload)
return
canvas = gracedb.replace_event.s(graceid, payload)
else:
graceid = gracedb.create_event(filecontents=payload,
search='Supernova',
group=ext_group,
pipeline=event_observatory)
event = gracedb.get_event(graceid)
start, end = event['gpstime'], event['gpstime']
# Pre-start and post-end padding is applied by check_vectors
detchar.check_vectors(event, event['graceid'], start, end)
canvas = gracedb.create_event.s(filecontents=payload,
search='Supernova',
group=ext_group,
pipeline=event_observatory)
canvas |= _launch_external_detchar.s()
canvas.delay()
@gcn.handler(gcn.NoticeType.FERMI_GBM_ALERT,
......
......@@ -350,10 +350,10 @@ def test_handle_skymap_combine(mock_create_combined_skymap):
@patch('gwcelery.tasks.detchar.dqr_json', return_value='dqrjson')
@patch('gwcelery.tasks.gracedb.upload.run')
@patch('gwcelery.tasks.gracedb.get_event', return_value={
'graceid': 'E1', 'gpstime': 1, 'instruments': '', 'pipeline': 'SNEWS'})
@patch('gwcelery.tasks.gracedb.create_event')
def test_handle_create_snews_event(mock_create_event, mock_get_event,
@patch('gwcelery.tasks.gracedb.create_event.run', return_value={
'graceid': 'E1', 'gpstime': 1, 'instruments': '', 'pipeline': 'SNEWS',
'search': 'Supernova'})
def test_handle_create_snews_event(mock_create_event,
mock_upload, mock_json):
text = read_binary(data, 'snews_gcn.xml')
external_triggers.handle_snews_gcn(payload=text)
......@@ -384,7 +384,7 @@ def test_handle_create_snews_event(mock_create_event, mock_get_event,
mock_upload.assert_has_calls(calls, any_order=True)
@patch('gwcelery.tasks.gracedb.replace_event')
@patch('gwcelery.tasks.gracedb.replace_event.run')
@patch('gwcelery.tasks.gracedb.get_events', return_value=[{'graceid': 'E1'}])
def test_handle_replace_snews_event(mock_get_events, mock_replace_event):
text = read_binary(data, 'snews_gcn.xml')
......
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