diff --git a/pypushflow/StopActor.py b/pypushflow/StopActor.py index 3d5058568a0803c7998342fdb9e517c315b030d6..d413e1d5e4b901916254a9029d8f7ba189e14633 100644 --- a/pypushflow/StopActor.py +++ b/pypushflow/StopActor.py @@ -32,7 +32,7 @@ class StopActor(ThreadCountingActor): def __init__(self, parent=None, errorHandler=None, name="Stop actor", **kw): super().__init__(name=name, parent=parent, **kw) self.errorHandler = errorHandler - self.outData = None + self._outData = None def trigger(self, inData): self.logger.info("triggered with inData =\n %s", pprint.pformat(inData)) @@ -44,6 +44,31 @@ class StopActor(ThreadCountingActor): else: self.outData = inData + @property + def outData(self): + return self._outData + + @outData.setter + def outData(self, data): + if data is None: + self._outData = None + return + if self._outData is None: + self._outData = data + return + inerror = data.get("WorkflowException") + outerror = self._outData.get("WorkflowException") + if inerror and outerror: + pass # keep the first error + elif inerror: + pass # keep the non-error result + elif outerror: + # keep the non-error result + self._outData = data + else: + # keep the last result + self._outData = data + def join(self, timeout=7200): if self.parent is not None: self.logger.debug("wait for scheduler threads to be finished") diff --git a/pypushflow/__init__.py b/pypushflow/__init__.py index 723ea86e651d45aa48fee783d60102f1002e8193..21eeb0c0b464403091ee23e72afc1483871d1894 100644 --- a/pypushflow/__init__.py +++ b/pypushflow/__init__.py @@ -23,4 +23,4 @@ __authors__ = ["O. Svensson"] __license__ = "MIT" __date__ = "28/05/2019" -__version__ = "0.3.0-beta.6" +__version__ = "0.3.0-beta.7"