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
e6759f7b
Commit
e6759f7b
authored
2 years ago
by
Deep Chatterjee
Browse files
Options
Downloads
Patches
Plain Diff
jsonify alert, needed for igwn-alert 0.2.2; fixes
#433
bug fix in
ceb4c768
parent
ceb4c768
No related branches found
No related tags found
1 merge request
!892
jsonify alert, needed for igwn-alert 0.2.2; fixes #433
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gwcelery/tasks/igwn_alert.py
+3
-0
3 additions, 0 deletions
gwcelery/tasks/igwn_alert.py
gwcelery/tests/test_tasks_igwn_alert.py
+6
-2
6 additions, 2 deletions
gwcelery/tests/test_tasks_igwn_alert.py
with
9 additions
and
2 deletions
gwcelery/tasks/igwn_alert.py
+
3
−
0
View file @
e6759f7b
"""
IGWN alert client.
"""
import
json
from
celery.utils.log
import
get_task_logger
from
..igwn_alert.signals
import
igwn_alert_received
...
...
@@ -19,6 +21,7 @@ class _IGWNAlertDispatchHandler(DispatchHandler):
return
super
().
__call__
(
*
keys
,
**
kwargs
)
def
process_args
(
self
,
topic
,
alert
):
alert
=
json
.
loads
(
alert
)
# Determine GraceDB service URL
try
:
try
:
...
...
This diff is collapsed.
Click to expand it.
gwcelery/tests/test_tasks_igwn_alert.py
+
6
−
2
View file @
e6759f7b
...
...
@@ -53,6 +53,8 @@ def test_handle_messages(mock_superevents_handle, mock_get_event,
alert
[
'
object
'
][
'
self
'
]
=
\
alert
[
'
object
'
][
'
self
'
].
replace
(
'
gracedb.ligo.org
'
,
'
gracedb.invalid
'
)
# dump back into string
alert
=
json
.
dumps
(
alert
)
# Run function under test
igwn_alert
.
handler
.
dispatch
(
node
,
alert
)
mock_superevents_handle
.
assert_called_once
()
...
...
@@ -70,7 +72,8 @@ def test_handle_messages_wrong_server(mock_superevents_handle,
alert
=
json
.
loads
(
payload
)
alert
[
'
object
'
][
'
self
'
]
=
\
alert
[
'
object
'
][
'
self
'
].
replace
(
'
gracedb.ligo.org
'
,
'
gracedb2.invalid
'
)
# dump back into string
alert
=
json
.
dumps
(
alert
)
# Run function under test
caplog
.
set_level
(
logging
.
WARNING
)
igwn_alert
.
handler
.
dispatch
(
node
,
alert
)
...
...
@@ -93,7 +96,8 @@ def test_handle_messages_no_self_link(mock_superevents_handle,
# Manipulate alert content
alert
=
json
.
loads
(
payload
)
del
alert
[
'
object
'
][
'
self
'
]
# dump back into string
alert
=
json
.
dumps
(
alert
)
# Run function under test
caplog
.
set_level
(
logging
.
ERROR
)
igwn_alert
.
handler
.
dispatch
(
node
,
alert
)
...
...
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