Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gwcelery
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
emfollow
gwcelery
Commits
30ac6ffb
Commit
30ac6ffb
authored
1 year ago
by
Naresh Adhikari
Browse files
Options
Downloads
Patches
Plain Diff
Prevent external event from switching superevents; fixes
#585
parent
73754dec
No related branches found
No related tags found
1 merge request
!1154
Prevent external event from switching superevents; fixes #585
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGES.rst
+2
-0
2 additions, 0 deletions
CHANGES.rst
gwcelery/tasks/raven.py
+4
-0
4 additions, 0 deletions
gwcelery/tasks/raven.py
gwcelery/tests/test_tasks_raven.py
+19
-9
19 additions, 9 deletions
gwcelery/tests/test_tasks_raven.py
with
25 additions
and
9 deletions
CHANGES.rst
+
2
−
0
View file @
30ac6ffb
...
...
@@ -39,6 +39,8 @@ Changelog
if grabbing a sky map from an external URL such as from Fermi-GBM that
lacks this field.
- Prevent external event from switching superevents.
2.0.4 "Skunk Ape" (2023-03-28)
------------------------------
...
...
This diff is collapsed.
Click to expand it.
gwcelery/tasks/raven.py
+
4
−
0
View file @
30ac6ffb
...
...
@@ -217,6 +217,10 @@ def raven_pipeline(raven_search_results, gracedb_id, alert_object, tl, th,
exttrig_id
=
gracedb_id
superevent
=
result
ext_event
=
alert_object
# Don't continue if it is a different superevent than previous one.
if
ext_event
[
'
superevent
'
]
is
not
None
\
and
ext_event
[
'
superevent
'
]
!=
superevent
[
'
superevent_id
'
]:
return
canvas
=
(
gracedb
.
add_event_to_superevent
.
si
(
superevent_id
,
exttrig_id
)
...
...
This diff is collapsed.
Click to expand it.
gwcelery/tests/test_tasks_raven.py
+
19
−
9
View file @
30ac6ffb
...
...
@@ -207,7 +207,9 @@ def mock_get_superevent(superevent_id):
[[{
'
superevent_id
'
:
'
S12
'
,
'
far
'
:
.
001
,
'
preferred_event
'
:
'
G3
'
}],
'
T4
'
,
-
10
,
10
,
'
Burst
'
],
[[{
'
superevent_id
'
:
'
MS13
'
,
'
far
'
:
1
,
'
preferred_event
'
:
'
M3
'
}],
'
M15
'
,
-
1
,
5
,
'
CBC
'
]])
'
M15
'
,
-
1
,
5
,
'
CBC
'
],
[[{
'
superevent_id
'
:
'
S13
'
,
'
far
'
:
1
,
'
preferred_event
'
:
'
G4
'
}],
'
E6
'
,
-
60
,
600
,
'
Burst
'
]])
@patch
(
'
gwcelery.tasks.raven.trigger_raven_alert.run
'
)
@patch
(
'
gwcelery.tasks.gracedb.get_labels
'
,
mock_get_labels
)
@patch
(
'
gwcelery.tasks.raven.calculate_coincidence_far.run
'
,
...
...
@@ -229,7 +231,8 @@ def test_raven_pipeline(mock_plot_overlap_integral,
"""
alert_object
=
{
'
preferred_event
'
:
'
G1
'
,
'
pipeline
'
:
'
Fermi
'
,
'
search
'
:
'
Supernova
'
if
graceid
==
'
T4
'
else
'
GRB
'
,
'
labels
'
:
[]}
'
labels
'
:
[],
'
superevent
'
:
None
if
graceid
!=
'
E6
'
else
'
S14
'
}
time_coinc_far
=
mock_coinc_far
()[
'
temporal_coinc_far
'
]
space_coinc_far
=
mock_coinc_far
()[
'
spatiotemporal_coinc_far
'
]
...
...
@@ -293,13 +296,20 @@ def test_raven_pipeline(mock_plot_overlap_integral,
alert_calls
.
append
(
call
(
mock_coinc_far
(),
result
,
graceid
,
alert_object
,
group
))
mock_trigger_raven_alert
.
assert_has_calls
(
alert_calls
,
any_order
=
True
)
mock_calculate_coincidence_far
.
assert_has_calls
(
coinc_calls
,
any_order
=
True
)
mock_update_superevent
.
assert_has_calls
(
update_calls
,
any_order
=
True
)
mock_create_label
.
assert_has_calls
(
label_calls
,
any_order
=
True
)
mock_plot_overlap_integral
.
assert_has_calls
(
plot_calls
,
any_order
=
True
)
if
graceid
!=
'
E6
'
:
mock_trigger_raven_alert
.
assert_has_calls
(
alert_calls
,
any_order
=
True
)
mock_calculate_coincidence_far
.
assert_has_calls
(
coinc_calls
,
any_order
=
True
)
mock_update_superevent
.
assert_has_calls
(
update_calls
,
any_order
=
True
)
mock_create_label
.
assert_has_calls
(
label_calls
,
any_order
=
True
)
mock_plot_overlap_integral
.
assert_has_calls
(
plot_calls
,
any_order
=
True
)
else
:
mock_trigger_raven_alert
.
assert_not_called
()
mock_calculate_coincidence_far
.
assert_not_called
()
mock_update_superevent
.
assert_not_called
()
mock_create_label
.
assert_not_called
()
mock_plot_overlap_integral
.
assert_not_called
()
@pytest.mark.parametrize
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment