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

Commit bef379ae authored by Olof Svensson's avatar Olof Svensson

Separated upload of inData and outData to MongoDB in order to avoid data being...

Separated upload of inData and outData to MongoDB in order to avoid data being overwritten by loops in workflows
parent 147c2943
......@@ -59,23 +59,25 @@ class AbstractActor(object):
))
actor.trigger(inData)
def uploadDataToMongo(self, actorData={}, script=None):
def uploadInDataToMongo(self, actorData={}, script=None):
if self.parent is not None:
if self.parent.mongoId is not None:
if self.actorId is None:
actorPath = self.getActorPath() + '/' + self.name
self.actorId = UtilsMongoDb.initActor(
workflowId=self.parent.mongoId,
name=actorPath,
actorData=actorData,
script=script
)
else:
UtilsMongoDb.addDataToActor(
workflowId=self.parent.mongoId,
actorId=self.actorId,
actorData=actorData
)
actorPath = self.getActorPath() + '/' + self.name
self.actorId = UtilsMongoDb.initActor(
workflowId=self.parent.mongoId,
name=actorPath,
actorData=actorData,
script=script
)
def uploadOutDataToMongo(self, actorData={}, script=None):
if self.parent is not None:
if self.parent.mongoId is not None:
UtilsMongoDb.addDataToActor(
workflowId=self.parent.mongoId,
actorId=self.actorId,
actorData=actorData
)
def setMongoAttribute(self, attribute, value):
if self.parent is not None:
......
......@@ -151,7 +151,7 @@ class PythonActor(AbstractActor):
def trigger(self, inData):
self.setStarted()
self.inData = dict(inData)
self.uploadDataToMongo(actorData={'inData': inData}, script=self.script)
self.uploadInDataToMongo(actorData={'inData': inData}, script=self.script)
logger.debug('In trigger {0}, inData = {1}'.format(self.name, pprint.pformat(inData)))
if isinstance(inData, WorkflowException):
logger.error('Error from previous actor! Not running actor {0}'.format(self.name))
......@@ -196,7 +196,7 @@ class PythonActor(AbstractActor):
'traceBack': workflowException.traceBack.split('\n'),
}
oldInData['WorkflowException'] = exceptionDict
self.uploadDataToMongo(actorData={
self.uploadOutDataToMongo(actorData={
'stopTime': datetime.datetime.now(),
'status': 'error',
'outData': exceptionDict
......@@ -208,7 +208,7 @@ class PythonActor(AbstractActor):
self.errorHandler.triggerOnError(inData=oldInData)
else:
outData = dict(inData)
self.uploadDataToMongo(actorData={
self.uploadOutDataToMongo(actorData={
'stopTime': datetime.datetime.now(),
'status': 'finished',
'outData': outData
......
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