[core] Node: stopComputation method

- Node: stopComputation method.
- Task Manager: avoid stopping the entire task manager when a node is stopped.
This commit is contained in:
Julien-Haudegond 2020-08-20 15:53:02 +02:00
parent 723e007ae6
commit b71832ebbd
2 changed files with 7 additions and 3 deletions

View file

@ -788,6 +788,12 @@ class BaseNode(BaseObject):
def endSequence(self): def endSequence(self):
pass pass
def stopComputation(self):
""" Stop the computation of this node. """
for chunk in self._chunks.values():
if not chunk.isExtern():
chunk.stopProcess()
def getGlobalStatus(self): def getGlobalStatus(self):
""" """
Get node global status based on the status of its chunks. Get node global status based on the status of its chunks.

View file

@ -56,9 +56,7 @@ class TaskThread(Thread):
chunk.process(self.forceCompute) chunk.process(self.forceCompute)
except Exception as e: except Exception as e:
if chunk.isStopped(): if chunk.isStopped():
self._state = State.STOPPED pass
self._manager._graph.clearSubmittedNodes()
self._manager._nodesToProcess = []
else: else:
logging.error("Error on node computation: {}".format(e)) logging.error("Error on node computation: {}".format(e))
nodesToRemove, _ = self._manager._graph.nodesFromNode(node) nodesToRemove, _ = self._manager._graph.nodesFromNode(node)