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

Commit 54bba7bd authored by Operator for ID30's avatar Operator for ID30

New scheme for setting outData from Python actor

parent 093e9092
......@@ -128,8 +128,7 @@ class ActorWrapper(object):
logger.debug('args={0}, kwargs={1}, method={2}'.format(args, kwargs, self.method))
inData = args[0]
outData = self.method(**inData)
inData.update(outData)
return inData
return outData
class PythonActor(AbstractActor):
......@@ -151,7 +150,7 @@ class PythonActor(AbstractActor):
def trigger(self, inData):
self.setStarted()
self.inData = inData
self.inData = dict(inData)
self.uploadDataToMongo(actorData={'inData': inData}, script=self.script)
logger.debug('In trigger {0}, inData = {1}'.format(self.name, pprint.pformat(inData)))
if isinstance(inData, WorkflowException):
......@@ -168,7 +167,7 @@ class PythonActor(AbstractActor):
self.af = AsyncFactory(self.actorWrapper.run,
callback=self.triggerDownStreamActor,
errorCallback=self.errorHandler)
self.af.call(inData)
self.af.call(self.inData)
def errorHandler(self, exception):
logger.error('Error when running actor {0}!'.format(self.name))
......@@ -208,13 +207,7 @@ class PythonActor(AbstractActor):
logger.error('Trigger on error on errorHandler "{0}"'.format(self.errorHandler.name))
self.errorHandler.triggerOnError(inData=oldInData)
else:
outData = {}
for key, value in inData.items():
if key in self.inData:
if self.inData[key] != value:
outData[key] = value
else:
outData[key] = value
outData = dict(inData)
self.uploadDataToMongo(actorData={
'stopTime': datetime.datetime.now(),
'status': 'finished',
......@@ -224,8 +217,10 @@ class PythonActor(AbstractActor):
self.setMongoAttribute("logFile", outData["workflowLogFile"])
if "workflowDebugLogFile" in outData:
self.setMongoAttribute("debugLogFile", outData["workflowDebugLogFile"])
downstreamData = dict(self.inData)
downstreamData.update(outData)
for downStreamActor in self.listDownStreamActor:
logger.debug('In trigger {0}, triggering actor {1}, inData={2}'.format(self.name, downStreamActor.name, inData))
downStreamActor.trigger(inData)
logger.debug('In trigger {0}, triggering actor {1}, inData={2}'.format(self.name, downStreamActor.name, downstreamData))
downStreamActor.trigger(downstreamData)
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