[graph] remove uid on node, use name as unique identifier

This commit is contained in:
Yann Lanthony 2017-10-30 11:38:42 +01:00
parent c1a0f43ee3
commit 263ad6b4f5

View file

@ -413,16 +413,6 @@ class Node(BaseObject):
def nodeType(self): def nodeType(self):
return self.nodeDesc.__class__.__name__ return self.nodeDesc.__class__.__name__
def uid(self):
return self.nodeUid
def _updateUid(self):
hashInputParams = [(attr.getName(), attr.uid()) for attr in self._attributes if
not attr.attributeDesc.isOutput]
hashInputParams.sort()
self.nodeUid = hash(tuple([b for a, b in hashInputParams]))
return self.nodeUid
@property @property
def depth(self): def depth(self):
return self.graph.getDepth(self) return self.graph.getDepth(self)
@ -437,8 +427,6 @@ class Node(BaseObject):
} }
def updateInternals(self): def updateInternals(self):
self._updateUid()
self._cmdVars = { self._cmdVars = {
'cache': self.graph.cacheDir, 'cache': self.graph.cacheDir,
} }
@ -578,7 +566,7 @@ class Node(BaseObject):
def process(self): def process(self):
global runningProcesses global runningProcesses
runningProcesses[self.uid()] = self runningProcesses[self.name] = self
self.upgradeStatusTo(Status.RUNNING) self.upgradeStatusTo(Status.RUNNING)
statThread = stats.StatisticsThread(self) statThread = stats.StatisticsThread(self)
statThread.start() statThread.start()
@ -607,7 +595,6 @@ class Node(BaseObject):
raise RuntimeError('Error on node "{}":\nLog:\n{}'.format(self.name, logContent)) raise RuntimeError('Error on node "{}":\nLog:\n{}'.format(self.name, logContent))
except BaseException: except BaseException:
self.upgradeStatusTo(Status.ERROR) self.upgradeStatusTo(Status.ERROR)
del runningProcesses[self.uid()]
raise raise
finally: finally:
elapsedTime = time.time() - startTime elapsedTime = time.time() - startTime
@ -616,9 +603,9 @@ class Node(BaseObject):
# ask and wait for the stats thread to stop # ask and wait for the stats thread to stop
statThread.stopRequest() statThread.stopRequest()
statThread.join() statThread.join()
del runningProcesses[self.name]
self.upgradeStatusTo(Status.SUCCESS) self.upgradeStatusTo(Status.SUCCESS)
del runningProcesses[self.uid()]
def endSequence(self): def endSequence(self):
pass pass