Commit 93c4bd95 authored by Operator for ID30's avatar Operator for ID30
Browse files

Bug fix for Stop actor

parent 4e8fb796
......@@ -27,6 +27,7 @@ import logging
import multiprocessing
from pypushflow import UtilsMongoDb
from pypushflow import Submodel
logger = logging.getLogger('pypushflow')
......@@ -43,14 +44,18 @@ class StopActor(object):
def trigger(self, inData):
logger.debug('In trigger {0}, errorHandler = {1}'.format(self.name, self.errorHandler))
if self.parent is not None and hasattr(self.parent, 'mongoId'):
# Check if parent is workflow
if self.parent is not None and not isinstance(self.parent, Submodel.Submodel):
UtilsMongoDb.closeMongo(self.parent.mongoId)
if self.errorHandler is not None:
self.errorHandler.errorHandler.stopActor.trigger(inData)
else:
self.outData = inData
logger.error('In {0}, parent {1}, before lock.release'.format(self.name, self.parent.name))
self.lock.release()
logger.error('In {0}, parent {1}, after lock.release'.format(self.name, self.parent.name))
else:
self.errorHandler.errorHandler.stopActor.trigger(inData)
def join(self, timeout=7200):
logger.error('In {0}, parent {1}, before lock.acquire'.format(self.name, self.parent.name))
self.lock.acquire(timeout=timeout)
logger.error('In {0}, parent {1}, after lock.acquire'.format(self.name, self.parent.name))
......@@ -41,13 +41,14 @@ class Workflow(object):
self.mongoId = UtilsMongoDb.initMongo(name=name)
def connectOnError(self, actor):
logger.debug("In connectOnError in subModule {0}, actor name {1}".format(self.name, actor.name))
logger.debug("In Workflow '{0}' connectOnError, actor name {1}".format(self.name, actor.name))
self.listOnErrorActor.append(actor)
def triggerOnError(self, inData):
logger.debug("In Workflow '{0}' triggerOnError, inData:".format(self.name))
logger.debug(pprint.pformat(inData))
for onErrorActor in self.listOnErrorActor:
logger.debug(onErrorActor.trigger)
logger.debug("In Workflow '{0}' triggerOnError, triggering actor name {1}".format(self.name, onErrorActor.name))
onErrorActor.trigger(inData)
def getActorPath(self):
......
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