Skip to content

Commit 3cf27b0

Browse files
committed
[code] graph : Better management of statuses after task/job actions
1 parent 95bfbcf commit 3cf27b0

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

meshroom/core/node.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ def setNodeType(self, node):
145145
self.mrNodeType = node.getMrNodeType()
146146

147147
def toDict(self):
148-
import traceback
149148
keys = list(self.__slots__) or []
150149
d = {key:getattr(self, key) for key in keys}
151150
for _k, _v in d.items():
@@ -155,7 +154,6 @@ def toDict(self):
155154
if self.chunks:
156155
chunks = list(self.chunks)
157156
d["chunks"] = chunks
158-
traceback.print_stack()
159157
return d
160158

161159
def fromDict(self, d):

meshroom/core/taskManager.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,6 @@ def submit(self, graph, submitter=None, toNodes=None, submitLabel="{projectName}
526526
node.destroyed.connect(lambda obj=None, name=node.name: self.onNodeDestroyed(obj, name))
527527
node.initStatusOnSubmit()
528528

529-
print("[TaskManager] (submit) graph.updateMonitoredFiles")
530529
graph.updateMonitoredFiles()
531530

532531
flowEdges = graph.flowEdges(startNodes=toNodes)

meshroom/ui/graph.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,6 @@ def updateChunks(self):
435435
if node._chunksCreated:
436436
nodechunks = node.getChunks()
437437
chunks.extend(nodechunks)
438-
else:
439438
if self._sortedDFSChunks.objectList() == chunks:
440439
# Nothing has changed, return
441440
return
@@ -624,6 +623,7 @@ def stopTask(self, chunk: NodeChunk):
624623
else:
625624
chunk.updateStatusFromCache()
626625
chunk.upgradeStatusTo(Status.STOPPED)
626+
# TODO : Stop depending nodes ?
627627
self.parent().showMessage(f"Stopped chunk {chunkIteration} of {node.label}")
628628
else:
629629
chunk.stopProcess()
@@ -649,6 +649,7 @@ def stopNode(self, node: Node):
649649
else:
650650
node.updateNodeStatusFromCache()
651651
node.upgradeStatusTo(Status.STOPPED)
652+
# TODO : Stop depending nodes ?
652653
self.parent().showMessage(f"Stopped node {node.label}")
653654
else:
654655
self.cancelNodeComputation(node)
@@ -686,7 +687,6 @@ def skipTask(self, chunk: NodeChunk):
686687
In local mode, the chunk status will be set to success
687688
"""
688689
chunk.updateStatusFromCache()
689-
chunk.upgradeStatusTo(Status.NONE)
690690
node = chunk.node
691691
chunkIteration = chunk.range.iteration
692692
job = jobManager.getNodeJob(node)
@@ -697,6 +697,7 @@ def skipTask(self, chunk: NodeChunk):
697697
self.parent().showMessage(f"Failed to skip chunk {chunkIteration} of {node.label}", "error")
698698
logging.warning(f"Error on skipTask :\n{e}")
699699
else:
700+
chunk.upgradeStatusTo(Status.SUCCESS)
700701
self.parent().showMessage(f"Skipped chunk {chunkIteration} of {node.label}")
701702
else:
702703
chunk.stopProcess()
@@ -765,7 +766,8 @@ def interruptJob(self, node: Node):
765766
for chunk in self._sortedDFSChunks:
766767
if jobManager.getNodeJob(chunk.node) == job:
767768
chunk.updateStatusFromCache()
768-
chunk.upgradeStatusTo(Status.SUBMITTED)
769+
chunk.upgradeStatusTo(Status.STOPPED)
770+
# TODO : Also nodes without chunks ?
769771
self.parent().showMessage(f"Interrupted the job for node {node}")
770772
else:
771773
self._taskManager.clear()
@@ -782,7 +784,15 @@ def restartJobErrorTasks(self, node: Node):
782784
job = jobManager.getNodeJob(node)
783785
if job:
784786
try:
787+
# Fist update status of each chunk to submitted
788+
for chunk in self._sortedDFSChunks:
789+
if chunk._status.status not in (Status.ERROR, Status.STOPPED, Status.KILLED):
790+
continue
791+
if jobManager.getNodeJob(chunk.node) == job:
792+
chunk.upgradeStatusTo(Status.SUBMITTED)
793+
# TODO : Also nodes without chunks ?
785794
job.restartErrorTasks()
795+
job.resumeJob()
786796
except Exception as e:
787797
self.parent().showMessage(f"Failed to restart error tasks for node {node.label} on farm", "error")
788798
logging.warning(f"Error on restartJobErrorTasks :\n{e}")

meshroom/ui/qml/GraphEditor/TaskManager.qml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Item {
160160
MaterialToolButton {
161161
ToolTip.text: "Pause job"
162162
Layout.alignment: Qt.AlignHCenter
163-
enabled: selectedChunk !== null
163+
enabled: root.uigraph.selectedNode !== null
164164
text: MaterialIcons.pause_circle_filled
165165
font.pointSize: 15
166166
onClicked: {
@@ -171,7 +171,7 @@ Item {
171171
MaterialToolButton {
172172
ToolTip.text: "Resume job"
173173
Layout.alignment: Qt.AlignHCenter
174-
enabled: selectedChunk !== null
174+
enabled: root.uigraph.selectedNode !== null
175175
text: MaterialIcons.play_circle_filled
176176
font.pointSize: 15
177177
onClicked: {
@@ -182,7 +182,7 @@ Item {
182182
MaterialToolButton {
183183
ToolTip.text: "Interrupt job"
184184
Layout.alignment: Qt.AlignHCenter
185-
enabled: selectedChunk !== null
185+
enabled: root.uigraph.selectedNode !== null
186186
text: MaterialIcons.stop_circle
187187
font.pointSize: 15
188188
onClicked: {
@@ -193,7 +193,7 @@ Item {
193193
MaterialToolButton {
194194
ToolTip.text: "Restart all error tasks"
195195
Layout.alignment: Qt.AlignHCenter
196-
enabled: selectedChunk !== null
196+
enabled: root.uigraph.selectedNode !== null
197197
text: MaterialIcons.replay_circle_filled // MaterialIcons.restart_alt
198198
font.pointSize: 15
199199
onClicked: {

0 commit comments

Comments
 (0)