mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-16 00:05:26 +02:00
[ui] Graph: stop and cancel node computation
This commit is contained in:
parent
b71832ebbd
commit
f41565f26b
2 changed files with 45 additions and 0 deletions
|
@ -389,6 +389,37 @@ class UIGraph(QObject):
|
|||
self._taskManager._thread.join()
|
||||
self.computeStatusChanged.emit()
|
||||
|
||||
@Slot(Node)
|
||||
def stopNodeComputation(self, node):
|
||||
""" Stop the computation of the node and update all the nodes depending on it. """
|
||||
if not self.isComputingLocally():
|
||||
return
|
||||
|
||||
# Stop the node and wait Task Manager
|
||||
node.stopComputation()
|
||||
self._taskManager._thread.join()
|
||||
|
||||
# If some dependent nodes are submitted, the first one will be in error
|
||||
# Make sure to remove those nodes from the Task Manager list
|
||||
dependentNodes = self._graph.nodesDependingOnNode(node)
|
||||
for node in dependentNodes[1:]: # exclude current node
|
||||
if node.getGlobalStatus() == Status.ERROR:
|
||||
node.upgradeStatusTo(Status.NONE)
|
||||
self._taskManager.removeNode(node)
|
||||
|
||||
self.computeStatusChanged.emit()
|
||||
|
||||
@Slot(Node)
|
||||
def cancelNodeComputation(self, node):
|
||||
""" Cancel the computation of the node and all the nodes depending on it. """
|
||||
if node.getGlobalStatus() == Status.SUBMITTED:
|
||||
# Current node belongs to this list
|
||||
for node in self._graph.nodesDependingOnNode(node):
|
||||
# Status from SUBMITTED to NONE
|
||||
node.clearSubmittedChunks()
|
||||
# Make sure to remove the node from the Task Manager list
|
||||
self._taskManager.removeNode(node)
|
||||
|
||||
@Slot(Node)
|
||||
def submit(self, node=None):
|
||||
""" Submit the graph to the default Submitter.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue