diff --git a/meshroom/core/node.py b/meshroom/core/node.py index bda239a3..16e91d14 100644 --- a/meshroom/core/node.py +++ b/meshroom/core/node.py @@ -411,11 +411,12 @@ class NodeChunk(BaseObject): try: self.node.nodeDesc.processChunk(self) except Exception as e: + self._status.elapsedTime = time.time() - startTime if self._status.status != Status.STOPPED: - self._status.elapsedTime = time.time() - startTime self.upgradeStatusTo(Status.ERROR) raise except (KeyboardInterrupt, SystemError, GeneratorExit) as e: + self._status.elapsedTime = time.time() - startTime self.upgradeStatusTo(Status.STOPPED) raise finally: @@ -806,6 +807,14 @@ class BaseNode(BaseObject): shutil.rmtree(self.internalFolder) self.updateStatusFromCache() + @Slot(result=str) + def getStartDateTime(self): + """ Return the date (str) of the first running chunk """ + if not self.isAlreadySubmittedOrFinished() or len(self._chunks) == 0: + return "" + dateTime = [chunk._status.startDateTime for chunk in self._chunks if chunk._status.startDateTime != ""] + return min(dateTime) if len(dateTime) != 0 else "" + def isAlreadySubmitted(self): for chunk in self._chunks: if chunk.isAlreadySubmitted(): @@ -828,13 +837,10 @@ class BaseNode(BaseObject): return True return False - @Slot(result=str) - def getFirstChunkRunning(self): - """ Return the date (str) of the first running chunk """ - if not self.isAlreadySubmittedOrFinished() or len(self._chunks) == 0: - return "" - dateTime = [chunk._status.startDateTime for chunk in self._chunks if chunk._status.startDateTime != ""] - return min(dateTime) if len(dateTime) != 0 else "" + @Slot(result=bool) + def isRunning(self): + """ Return True if at least one chunk of this Node is running, False otherwise. """ + return any(chunk.isRunning() for chunk in self._chunks) @Slot(result=bool) def isFinishedOrRunning(self): diff --git a/meshroom/ui/qml/GraphEditor/NodeEditor.qml b/meshroom/ui/qml/GraphEditor/NodeEditor.qml index ad86a3d0..2e08578e 100644 --- a/meshroom/ui/qml/GraphEditor/NodeEditor.qml +++ b/meshroom/ui/qml/GraphEditor/NodeEditor.qml @@ -27,7 +27,7 @@ Panel { onNodeChanged: { nodeStartDateTime = "" - if (node !== null && node.isSubmittedOrRunning()) { + if (node !== null && node.isRunning()) { timer.start() } else if (node !== null && (node.isFinishedOrRunning() || node.globalStatus=="ERROR")) { @@ -46,23 +46,25 @@ Panel { interval: 2500 triggeredOnStart: true repeat: true - running: node !== null && node.isSubmittedOrRunning() + running: node !== null && node.isRunning() onTriggered: { if (nodeStartDateTime === "") { - nodeStartDateTime = new Date(node.getFirstChunkRunning()).getTime() - } + nodeStartDateTime = new Date(node.getStartDateTime()).getTime() + } var now = new Date().getTime() - parent.text=Format.getTimeStr((now-nodeStartDateTime)/1000) + var runningTime=Format.getTimeStr((now-nodeStartDateTime)/1000) - var chunkCompletion=0 - if (node.chunks.count>1) { + var chunksCompleted = 0 + var chunkCompletion = "" + if (node.chunks.count>0) { for (var i = 0; i < node.chunks.count; i++) { if (node.chunks.at(i).statusName == "SUCCESS") { - chunkCompletion++ + chunksCompleted++ } } - parent.text+= " | "+ chunkCompletion + "/" + node.chunks.count + " chunks" + chunkCompletion = " | "+ chunksCompleted + "/" + node.chunks.count + " chunk" + (node.chunks.count == 1 ? "" : "s") } + parent.text = runningTime + chunkCompletion } }