GitLab will be upgraded on June 23rd evening. During the upgrade the service will be unavailable, sorry for the inconvenience.

Commit a9a88baf authored by Operator for ID30's avatar Operator for ID30

Fix for failing tests

parent f0c27739
......@@ -30,9 +30,10 @@ from pypushflow.AbstractActor import AbstractActor
class ErrorHandler(AbstractActor):
def __init__(self, parent, name='Error handler'):
def __init__(self, parent=None, name='Error handler'):
AbstractActor.__init__(self, parent=parent, name=name)
def trigger(self, inData):
UtilsMongoDb.setMongoStatus(self.parent.mongoId, 'error')
if self.parent is not None and hasattr(self.parent, 'mongoId'):
UtilsMongoDb.setMongoStatus(self.parent.mongoId, 'error')
AbstractActor.trigger(self, inData=inData)
......@@ -28,5 +28,5 @@ from pypushflow.AbstractActor import AbstractActor
class ForkActor(AbstractActor):
def __init__(self, parent, name='Fork actor'):
def __init__(self, parent=None, name='Fork actor'):
AbstractActor.__init__(self, parent=parent, name=name)
......@@ -28,7 +28,7 @@ from pypushflow.AbstractActor import AbstractActor
class JoinActor(AbstractActor):
def __init__(self, parent, name='Join actor'):
def __init__(self, parent=None, name='Join actor'):
AbstractActor.__init__(self, parent=parent, name=name)
self.numberOfThreads = 0
self.listInData = []
......
......@@ -201,7 +201,7 @@ class PythonActor(AbstractActor):
for errorHandler in self.listErrorHandler:
errorHandler.trigger(oldInData)
if self.errorHandler is not None:
logger.error('Trigger on error on errorHandler {0}'.format(self.errorHandler.name))
logger.error('Trigger on error on errorHandler "{0}"'.format(self.errorHandler.name))
self.errorHandler.triggerOnError(inData=oldInData)
else:
outData = {}
......
......@@ -43,7 +43,8 @@ class StopActor(object):
def trigger(self, inData):
logger.debug('In trigger {0}, errorHandler = {1}'.format(self.name, self.errorHandler))
UtilsMongoDb.closeMongo(self.parent.mongoId)
if self.parent is not None and hasattr(self.parent, 'mongoId'):
UtilsMongoDb.closeMongo(self.parent.mongoId)
if self.errorHandler is not None:
self.errorHandler.errorHandler.stopActor.trigger(inData)
else:
......
......@@ -50,7 +50,7 @@ class Workflow1(Workflow):
def run(self, inData):
self.startActor.trigger(inData)
self.stopActor.join(timeout=5)
self.stopActor.join(timeout=15)
return self.stopActor.outData
......@@ -114,7 +114,7 @@ class Workflow3(Workflow):
def run(self, inData):
self.startActor.trigger(inData)
self.stopActor.join(timeout=5)
self.stopActor.join(timeout=15)
return self.stopActor.outData
......
......@@ -23,11 +23,12 @@ __authors__ = ["O. Svensson"]
__license__ = "MIT"
__date__ = "28/05/2019"
import time
def run(name, **kwargs):
time.sleep(5)
reply = None
if name is not None:
reply = 'Hello ' + name + '!'
return {'reply': reply}
......@@ -63,4 +63,4 @@ class TestUtilsMongoDb(unittest.TestCase):
actorName2 = 'TestActor2'
actorId2 = UtilsMongoDb.initActor(name=actorName2, workflowId=workflowId)
inData = {'a': 1}
UtilsMongoDb.addDataToActor(workflowId=workflowId, actorId=actorId1, key='inData', value=inData)
\ No newline at end of file
UtilsMongoDb.addDataToActor(workflowId=workflowId, actorId=actorId1, actorData={'inData': inData})
\ No newline at end of file
Markdown is supported
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