Commit d561a805 authored by Wout De Nolf's avatar Wout De Nolf
Browse files

async callback exceptions were not handled properly (no capturing up the stack)

parent a01e888c
Pipeline #55738 passed with stages
in 53 seconds
...@@ -118,7 +118,7 @@ class PythonActor(AbstractActor): ...@@ -118,7 +118,7 @@ class PythonActor(AbstractActor):
self.listErrorHandler.append(errorHandler) self.listErrorHandler.append(errorHandler)
def trigger(self, inData: dict): def trigger(self, inData: dict):"In trigger %s, inData = %s",, pprint.pformat(inData)) logger.debug("In trigger %s, inData = %s",, pprint.pformat(inData))
self.setStarted() self.setStarted()
self.inData = dict(inData) self.inData = dict(inData)
self.uploadInDataToMongo(actorData={"inData": inData}, script=self.script) self.uploadInDataToMongo(actorData={"inData": inData}, script=self.script)
...@@ -141,29 +141,38 @@ class PythonActor(AbstractActor): ...@@ -141,29 +141,38 @@ class PythonActor(AbstractActor):**self.inData)**self.inData)
def resultHandler(self, result: dict): def resultHandler(self, result: dict):
# Handle the result """Async callback in case of success"""
logger.debug("In resultHandler for '%s'", try:
self._finishedSuccess(result) # Handle the result
logger.debug("In resultHandler for '%s'",
# Trigger actors self._finishedSuccess(result)
downstreamData = dict(self.inData)
downstreamData.update(result) # Trigger actors
self._triggerDownStreamActors(downstreamData) downstreamData = dict(self.inData)
except Exception as e:
def errorHandler(self, exception: Exception): def errorHandler(self, exception: Exception):
# Handle the result """Async callback in case of exception"""
logger.error( try:
"Error in python actor '%s'! Not running down stream actors %s", # Handle the result, logger.debug("In errorHandler for '%s'",
[ for actor in self.listDownStreamActor], logger.error(
) "Error in python actor '%s'! Not running down stream actors %s",
result = self._parseException(exception),
self._finishedFailure(result) [ for actor in self.listDownStreamActor],
# Trigger actors result = self._parseException(exception)
downstreamData = dict(self.inData) self._finishedFailure(result)
downstreamData["WorkflowException"] = result
self._triggerErrorHandlers(downstreamData) # Trigger actors
downstreamData = dict(self.inData)
downstreamData["WorkflowException"] = result
except Exception:
logger.exception("In errorHandler for '%s'",
def _parseException(self, exception: Exception) -> dict: def _parseException(self, exception: Exception) -> dict:
errorMessage = str(exception) errorMessage = str(exception)
Supports Markdown
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