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

Commit 7153e1e8 authored by Olof Svensson's avatar Olof Svensson

Renamed 'parent' to 'errorHandler'

parent 3cbe74f2
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/pypushflow" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
......
This diff is collapsed.
......@@ -31,9 +31,9 @@ logger = logging.getLogger('pypushflow')
class RouterActor(AbstractActor):
def __init__(self, parent=None, name='Router', itemName=None, listPort=[]):
def __init__(self, errorHandler=None, name='Router', itemName=None, listPort=[]):
AbstractActor.__init__(self, name)
self.parent=parent
self.errorHandler=errorHandler
self.name = name
self.itemName = itemName
self.listPort = listPort
......
......@@ -31,17 +31,17 @@ logger = logging.getLogger('pypushflow')
class StopActor(object):
def __init__(self, parent=None, name='Stop actor'):
self.parent=parent
def __init__(self, errorHandler=None, name='Stop actor'):
self.errorHandler=errorHandler
self.name = name
self.lock = multiprocessing.Lock()
self.lock.acquire()
self.outData = None
def trigger(self, inData):
logger.debug('In trigger {0}, parent = {1}'.format(self.name, self.parent))
if self.parent is not None:
self.parent.parent.stopActor.trigger(inData)
logger.debug('In trigger {0}, errorHandler = {1}'.format(self.name, self.errorHandler))
if self.errorHandler is not None:
self.errorHandler.errorHandler.stopActor.trigger(inData)
else:
self.outData = inData
self.lock.release()
......
......@@ -30,9 +30,9 @@ logger = logging.getLogger('pypushflow')
class Port(object):
def __init__(self, parent, name):
self.name = parent.name + '.' + name
self.parent = parent
def __init__(self, errorHandler, name):
self.name = errorHandler.name + '.' + name
self.errorHandler = errorHandler
self.listActor = []
self.inPortTrigger = None
......@@ -47,18 +47,18 @@ class Port(object):
logger.debug("In {0} trigger".format(self.name))
if len(self.listActor) > 0:
for actor in self.listActor:
logger.debug("In trigger {0} -> actorName {1}".format(self.parent.name, actor.name))
logger.debug("In trigger {0} -> actorName {1}".format(self.errorHandler.name, actor.name))
actor.trigger(*args, **kwargs)
if self.inPortTrigger is not None:
logger.debug("In {0} trigger, trigger = {1}".format(self.parent.name, self.inPortTrigger))
logger.debug("In {0} trigger, trigger = {1}".format(self.errorHandler.name, self.inPortTrigger))
self.inPortTrigger(*args, **kwargs)
class Submodel(object):
def __init__(self, parent=None, name=None, portNames=['In', 'Out']):
def __init__(self, errorHandler=None, name=None, portNames=['In', 'Out']):
self.name = name
self.parent = parent
self.errorHandler = errorHandler
self.dictPort = {}
self.listOnErrorActor = []
for portName in portNames:
......@@ -80,5 +80,5 @@ class Submodel(object):
for onErrorActor in self.listOnErrorActor:
logger.debug("In triggerOnError in subModule {0}, trigger actor {1}, inData = {2}".format(self.name, onErrorActor.name, args[0]))
onErrorActor.trigger(*args, **kwargs)
if self.parent is not None:
self.parent.triggerOnError(*args, **kwargs)
\ No newline at end of file
if self.errorHandler is not None:
self.errorHandler.triggerOnError(*args, **kwargs)
\ 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