Skip to content
Snippets Groups Projects
Commit 46eaba68 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

SW-699: just let the exception bubble upwards

parent 96e2de8c
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
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