Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
RadioObservatory
LOFAR
Commits
46eaba68
Commit
46eaba68
authored
5 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
SW-699
: just let the exception bubble upwards
parent
96e2de8c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
LTA/LTAIngest/LTAIngestClient/lib/ingestbuslistener.py
+26
-31
26 additions, 31 deletions
LTA/LTAIngest/LTAIngestClient/lib/ingestbuslistener.py
with
26 additions
and
31 deletions
LTA/LTAIngest/LTAIngestClient/lib/ingestbuslistener.py
+
26
−
31
View file @
46eaba68
...
...
@@ -34,40 +34,35 @@ logger = logging.getLogger()
class
IngestEventMessageHandler
(
AbstractMessageHandler
):
def
handle_message
(
self
,
msg
:
EventMessage
)
->
bool
:
def
handle_message
(
self
,
msg
:
EventMessage
):
if
not
isinstance
(
msg
,
EventMessage
):
raise
ValueError
(
"
%s: Ignoring non-EventMessage: %s
"
%
(
self
.
__class__
.
__name__
,
msg
))
try
:
stripped_subject
=
msg
.
subject
.
replace
(
"
%s.
"
%
INGEST_NOTIFICATION_PREFIX
,
''
)
self
.
_log_job_notification
(
stripped_subject
,
msg
.
content
)
# map msg subject onto callback method
if
stripped_subject
==
'
JobStarted
'
:
self
.
onJobStarted
(
msg
.
content
)
elif
stripped_subject
==
'
JobFinished
'
:
self
.
onJobFinished
(
msg
.
content
)
elif
stripped_subject
==
'
JobFailed
'
:
self
.
onJobFailed
(
msg
.
content
)
elif
stripped_subject
==
'
JobProgress
'
:
self
.
onJobProgress
(
msg
.
content
)
elif
stripped_subject
==
'
JobRemoved
'
:
self
.
onJobRemoved
(
msg
.
content
)
elif
stripped_subject
==
'
JobTransferFailed
'
:
self
.
onJobTransferFailed
(
msg
.
content
)
elif
stripped_subject
==
'
TaskProgress
'
:
self
.
onTaskProgress
(
msg
.
content
)
elif
stripped_subject
==
'
TaskFinished
'
:
self
.
onTaskFinished
(
msg
.
content
)
elif
stripped_subject
==
'
TransferServiceStatus
'
:
self
.
onTransferServiceStatus
(
msg
.
content
)
else
:
raise
ValueError
(
"
IngestEventMessageHandler.handleMessage: unknown subject: %s
"
%
msg
.
subject
)
except
Exception
as
e
:
logger
.
exception
(
"
IngestEventMessageHandler.handleMessage: %s
"
,
e
)
raise
stripped_subject
=
msg
.
subject
.
replace
(
"
%s.
"
%
INGEST_NOTIFICATION_PREFIX
,
''
)
self
.
_log_job_notification
(
stripped_subject
,
msg
.
content
)
# map msg subject onto callback method
if
stripped_subject
==
'
JobStarted
'
:
self
.
onJobStarted
(
msg
.
content
)
elif
stripped_subject
==
'
JobFinished
'
:
self
.
onJobFinished
(
msg
.
content
)
elif
stripped_subject
==
'
JobFailed
'
:
self
.
onJobFailed
(
msg
.
content
)
elif
stripped_subject
==
'
JobProgress
'
:
self
.
onJobProgress
(
msg
.
content
)
elif
stripped_subject
==
'
JobRemoved
'
:
self
.
onJobRemoved
(
msg
.
content
)
elif
stripped_subject
==
'
JobTransferFailed
'
:
self
.
onJobTransferFailed
(
msg
.
content
)
elif
stripped_subject
==
'
TaskProgress
'
:
self
.
onTaskProgress
(
msg
.
content
)
elif
stripped_subject
==
'
TaskFinished
'
:
self
.
onTaskFinished
(
msg
.
content
)
elif
stripped_subject
==
'
TransferServiceStatus
'
:
self
.
onTransferServiceStatus
(
msg
.
content
)
else
:
raise
ValueError
(
"
IngestEventMessageHandler.handleMessage: unknown subject: %s
"
%
msg
.
subject
)
def
onJobStarted
(
self
,
job_dict
):
'''
onJobStarted is called upon receiving a JobStarted message.
...
...
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