diff --git a/meshroom/core/graph.py b/meshroom/core/graph.py index 4ad528fd..235239f9 100644 --- a/meshroom/core/graph.py +++ b/meshroom/core/graph.py @@ -1366,6 +1366,11 @@ class Graph(BaseObject): for node in self.nodes: node.clearSubmittedChunks() + def clearLocallySubmittedNodes(self): + """ Reset the status of already locally submitted nodes to Status.NONE """ + for node in self.nodes: + node.clearLocallySubmittedChunks() + def iterChunksByStatus(self, status): """ Iterate over NodeChunks with the given status """ for node in self.nodes: diff --git a/meshroom/core/node.py b/meshroom/core/node.py index 29df5be3..dd992e04 100644 --- a/meshroom/core/node.py +++ b/meshroom/core/node.py @@ -433,7 +433,8 @@ class NodeChunk(BaseObject): self.node.nodeDesc.stopProcess(self) def isExtern(self): - return self._status.execMode == ExecMode.EXTERN + return self._status.execMode == ExecMode.EXTERN or ( + self._status.execMode == ExecMode.LOCAL and self._status.sessionUid != meshroom.core.sessionUid) statusChanged = Signal() status = Property(Variant, lambda self: self._status, notify=statusChanged) @@ -779,6 +780,12 @@ class BaseNode(BaseObject): if chunk.isAlreadySubmitted(): chunk.upgradeStatusTo(Status.NONE, ExecMode.NONE) + def clearLocallySubmittedChunks(self): + """ Reset all locally submitted chunks to Status.NONE. """ + for chunk in self._chunks: + if chunk.isAlreadySubmitted() and not chunk.isExtern(): + chunk.upgradeStatusTo(Status.NONE, ExecMode.NONE) + def upgradeStatusTo(self, newStatus): """ Upgrade node to the given status and save it on disk. diff --git a/meshroom/ui/graph.py b/meshroom/ui/graph.py index 7ace78d0..e7c6ae77 100644 --- a/meshroom/ui/graph.py +++ b/meshroom/ui/graph.py @@ -11,6 +11,7 @@ from multiprocessing.pool import ThreadPool from PySide2.QtCore import Slot, QJsonValue, QObject, QUrl, Property, Signal, QPoint from meshroom import multiview +from meshroom.core import sessionUid from meshroom.common.qt import QObjectListModel from meshroom.core.attribute import Attribute, ListAttribute from meshroom.core.graph import Graph, Edge @@ -283,6 +284,9 @@ class UIGraph(QObject): """ Set the internal graph. """ if self._graph: self.stopExecution() + # Clear all the locally submitted nodes at once before the graph gets changed, as it won't receive further updates + if self._computingLocally: + self._graph.clearLocallySubmittedNodes() self.clear() oldGraph = self._graph self._graph = g @@ -457,7 +461,11 @@ class UIGraph(QObject): def updateGraphComputingStatus(self): # update graph computing status - computingLocally = any([ch.status.execMode == ExecMode.LOCAL and ch.status.status in (Status.RUNNING, Status.SUBMITTED) for ch in self._sortedDFSChunks]) + computingLocally = any([ + (ch.status.execMode == ExecMode.LOCAL and + ch.status.sessionUid == sessionUid and + ch.status.status in (Status.RUNNING, Status.SUBMITTED)) + for ch in self._sortedDFSChunks]) submitted = any([ch.status.status == Status.SUBMITTED for ch in self._sortedDFSChunks]) if self._computingLocally != computingLocally or self._submitted != submitted: self._computingLocally = computingLocally