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

Commit 521bb704 authored by Operator for ID30's avatar Operator for ID30

Added actorpath

parent 4a49d864
......@@ -57,6 +57,14 @@ class AbstractActor(object):
if self.parent is not None:
if self.parent.mongoId is not None:
if self.actorId is None:
self.actorId = UtilsMongoDb.initActor(workflowId=self.parent.mongoId, name=self.name, actorData=actorData)
actorPath = self.getActorPath() + '/' + self.name
self.actorId = UtilsMongoDb.initActor(
workflowId=self.parent.mongoId,
name=actorPath,
actorData=actorData
)
else:
UtilsMongoDb.addDataToActor(workflowId=self.parent.mongoId, actorId=self.actorId, actorData=actorData)
\ No newline at end of file
UtilsMongoDb.addDataToActor(workflowId=self.parent.mongoId, actorId=self.actorId, actorData=actorData)
def getActorPath(self):
return self.parent.getActorPath()
......@@ -203,7 +203,7 @@ class PythonActor(AbstractActor):
}
oldInData['WorkflowException'] = exceptionDict
self.uploadDataToMongo(actorData={
'stopTime': datetime.datetime.utcnow(),
'stopTime': datetime.datetime.now(),
'status': 'error',
'outData': exceptionDict
})
......@@ -221,7 +221,7 @@ class PythonActor(AbstractActor):
else:
outData[key] = value
self.uploadDataToMongo(actorData={
'stopTime': datetime.datetime.utcnow(),
'stopTime': datetime.datetime.now(),
'status': 'finished',
'outData': outData
})
......
......@@ -66,6 +66,9 @@ class Submodel(object):
for portName in portNames:
self.dictPort[portName] = Port(self, portName)
def getActorPath(self):
return self.parent.getActorPath() + '/' + self.name.replace('%', ' ')
def getPort(self, portName):
logger.debug("In {0} getPort, portName = {1}".format(self.name, portName))
return self.dictPort[portName]
......
......@@ -49,3 +49,6 @@ class Workflow(object):
for onErrorActor in self.listOnErrorActor:
logger.debug(onErrorActor.trigger)
onErrorActor.trigger(inData)
def getActorPath(self):
return '/' + self.name
......@@ -40,7 +40,7 @@ class TestWorkflows(unittest.TestCase):
def setUp(self):
os.environ['PYPUSHFLOW_MONGOURL'] = 'mongodb://pybes:pybes@linsvensson.esrf.fr:27017/pybes'
os.environ['PYPUSHFLOW_CREATOR'] = 'TestWorkflows'
os.environ['PYPUSHFLOW_INITIATOR'] = 'TestWorkflows'
def test_Workflow1(self):
testWorkflow1 = Workflow1('Test workflow 1')
......
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