Commit f2ac7bca authored by Brandon Piotrzkowski's avatar Brandon Piotrzkowski

Switch `EM_SENT` to `RAVEN_ALERT`

parent 051a48a2
......@@ -309,10 +309,10 @@ def trigger_raven_alert(coinc_far_json, superevent, gracedb_id,
coinc_far_f = coinc_far * trials_factor * (trials_factor - 1.)
pass_far_threshold = coinc_far_f <= far_threshold
no_previous_alert = {'EM_SENT'}.isdisjoint(
no_previous_alert = {'RAVEN_ALERT'}.isdisjoint(
gracedb.get_labels(superevent_id))
# If publishable, trigger an alert by applying `EM_SENT` label to
# If publishable, trigger an alert by applying `RAVEN_ALERT` label to
# preferred event
messages = []
if pass_far_threshold and not is_ext_subthreshold:
......@@ -324,9 +324,9 @@ def trigger_raven_alert(coinc_far_json, superevent, gracedb_id,
messages.append('Triggering RAVEN alert for %s' % (
preferred_gwevent_id))
(
gracedb.create_label.si('EM_SENT', superevent_id)
gracedb.create_label.si('RAVEN_ALERT', superevent_id)
|
gracedb.create_label.si('EM_SENT', preferred_gwevent_id)
gracedb.create_label.si('RAVEN_ALERT', preferred_gwevent_id)
).delay()
if not pass_far_threshold:
messages.append(('RAVEN: publishing criteria not met for %s,'
......
......@@ -59,7 +59,7 @@ def handle(payload):
if alert_type == 'label_added':
label = payload['data']['name']
group = payload['object']['group'].lower()
if label == 'EM_SENT':
if label == 'RAVEN_ALERT':
log.info('Label %s added to %s', label, gid)
elif label not in REQUIRED_LABELS_BY_GROUP[group]:
return
......@@ -406,7 +406,7 @@ def _should_publish(event):
trials_factor = app.conf['preliminary_alert_trials_factor'][group]
far_threshold = app.conf['preliminary_alert_far_threshold'][group]
far = trials_factor * event['far']
raven_coincidence = ('EM_SENT' in event['labels'])
raven_coincidence = ('RAVEN_ALERT' in event['labels'])
return not event['offline'], (far <= far_threshold or raven_coincidence)
......
......@@ -313,8 +313,8 @@ def test_trigger_raven_alert(mock_create_label, mock_update_superevent,
superevent_id,
em_type=ext_id,
coinc_far=coinc_far)
label_calls = [call('EM_SENT', superevent_id),
call('EM_SENT', preferred_id)]
label_calls = [call('RAVEN_ALERT', superevent_id),
call('RAVEN_ALERT', preferred_id)]
mock_create_label.assert_has_calls(label_calls)
else:
mock_create_label.assert_not_called()
......@@ -129,7 +129,7 @@ G000003_RESPONSE = {
},
"offline": False,
"gpstime": 1000000,
"labels": ["EM_SENT", "PASTRO_READY",
"labels": ["RAVEN_ALERT", "PASTRO_READY",
"EMBRIGHT_READY", "SKYMAP_READY"]
}
......@@ -320,9 +320,9 @@ def test_update_preferred_event(superevent_labels, new_event_labels,
@pytest.mark.parametrize('labels',
[['PASTRO_READY', 'EM_SENT'],
[['PASTRO_READY', 'RAVEN_ALERT'],
['SKYMAP_READY', 'EMBRIGHT_READY',
'PASTRO_READY', 'EM_SENT']])
'PASTRO_READY', 'RAVEN_ALERT']])
@patch('gwcelery.tasks.gracedb.create_label.run')
@patch('gwcelery.tasks.gracedb.get_superevent', s100response)
def test_raven_alert(mock_create_label, labels):
......@@ -360,7 +360,7 @@ def test_raven_alert(mock_create_label, labels):
},
},
"data": {
"name": "EM_SENT"
"name": "RAVEN_ALERT"
}
}
superevents.handle(payload)
......@@ -475,11 +475,11 @@ def test_upload_same_event():
['Burst', 'cwb', False, 1e-15, 'H1,L1', ['SKYMAP_READY'], True],
['Burst', 'cwb', False, 1e-15, 'H1,L1', [], False],
['Burst', 'cwb', True, 1e-30, 'H1,L1,V1', [], False],
['CBC', 'gstlal', False, 1.e-6, 'H1,L1,V1', ['EM_SENT'], False],
['CBC', 'gstlal', False, 1.e-6, 'H1,L1,V1', ['RAVEN_ALERT'], False],
['CBC', 'gstlal', False, 1.e-6, 'H1,L1,V1', [
'PASTRO_READY', 'SKYMAP_READY', 'EMBRIGHT_READY', 'EM_SENT'], True],
'PASTRO_READY', 'SKYMAP_READY', 'EMBRIGHT_READY', 'RAVEN_ALERT'], True],
['CBC', 'gstlal', False, 1.e-15, 'H1,L1,V1', [
'PASTRO_READY', 'SKYMAP_READY', 'EMBRIGHT_READY', 'EM_SENT'], True]])
'PASTRO_READY', 'SKYMAP_READY', 'EMBRIGHT_READY', 'RAVEN_ALERT'], True]])
def test_should_publish(group, pipeline, offline, far, instruments, labels,
expected_result):
event = dict(graceid='G123456',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment