Skip to content

Commit 96fee57

Browse files
committed
wip
1 parent a9948a5 commit 96fee57

4 files changed

Lines changed: 43 additions & 8 deletions

File tree

meshroom/core/desc/node.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# desc/node.py
2+
13
import enum
24
from inspect import getfile
35
from pathlib import Path

meshroom/core/graph.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,24 +1779,31 @@ def executeGraph(graph, toNodes=None, forceCompute=False, forceStatus=False):
17791779
node.initStatusOnCompute(forceCompute)
17801780

17811781
for n, node in enumerate(nodes):
1782+
print(f"(executeGraph) {n} {node}")
17821783
try:
17831784
# If the node is in compatibility mode, it cannot be computed
17841785
if node.isCompatibilityNode:
17851786
logging.warning(f"{node.name} is in Compatibility Mode and cannot be computed: {node.issueDetails}.")
17861787
continue
17871788

1789+
print("A")
17881790
node.preprocess()
17891791
if not node._chunksCreated:
1792+
print("B create chunks")
17901793
node.createChunks()
17911794
multiChunks = len(node.chunks) > 1
1795+
print("C")
17921796
for c, chunk in enumerate(node.chunks):
1797+
print("D", c, chunk)
17931798
if multiChunks:
17941799
print('\n[{node}/{nbNodes}]({chunk}/{nbChunks}) {nodeName}'.format(
17951800
node=n+1, nbNodes=len(nodes),
17961801
chunk=c+1, nbChunks=len(node.chunks), nodeName=node.nodeType))
17971802
else:
17981803
print(f'\n[{n + 1}/{len(nodes)}] {node.nodeType}')
1804+
print("E")
17991805
chunk.process(forceCompute)
1806+
print("F")
18001807
node.postprocess()
18011808
except Exception as exc:
18021809
logging.error(f"Error on node computation: {exc}")

meshroom/core/node.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env python
2+
3+
# core/node.py
4+
25
import sys
36
import atexit
47
import copy
@@ -657,13 +660,8 @@ def isFinished(self):
657660
return self._status.status == Status.SUCCESS
658661

659662
def process(self, forceCompute=False, inCurrentEnv=False):
660-
if self.isPreprocess:
661-
return self.node.nodeDesc.preprocess(self.node)
662-
if self.isPostprocess:
663-
return self.node.nodeDesc.postprocess(self.node)
664-
return self._process(forceCompute, inCurrentEnv)
663+
print(f"(NodeChunk) process {self} -> pre={self.isPreprocess}, post={self.isPostprocess}")
665664

666-
def _process(self, forceCompute=False, inCurrentEnv=False):
667665
if not forceCompute and self._status.status == Status.SUCCESS:
668666
logging.info(f"Node chunk already computed: {self.name}")
669667
return
@@ -672,33 +670,51 @@ def _process(self, forceCompute=False, inCurrentEnv=False):
672670
# This only happens once, when the node has the SUBMITTED status.
673671
# The sub-process will go through this method again, but the node status will
674672
# have been set to RUNNING.
673+
print(f"(_process) A")
675674
if not inCurrentEnv and self.node.getMrNodeType() == MrNodeType.NODE:
675+
print(f"(_process) B")
676676
self._processInIsolatedEnvironment()
677677
return
678678

679+
print(f"(_process) C")
679680
runningProcesses[self.name] = self
681+
print(f"(_process) D")
680682
self._status.setNode(self.node)
683+
print(f"(_process) E")
681684
self._status.initStartCompute()
685+
print(f"(_process) F")
682686
self.upgradeStatusFile()
687+
print(f"(_process) G")
683688
executionStatus = None
689+
print(f"(_process) H")
684690
self.statThread = stats.StatisticsThread(self)
691+
print(f"(_process) I")
685692
self.statThread.start()
686693

694+
print(f"(_process) J")
687695
try:
688-
logging.info(f"[Process chunk] Start processing...")
689-
self.node.nodeDesc.processChunk(self)
696+
print(f"(_process) K")
697+
if self.isPreprocess:
698+
self.node.nodeDesc.preprocess(self.node)
699+
elif self.isPostprocess:
700+
self.node.nodeDesc.postprocess(self.node)
701+
else:
702+
self.node.nodeDesc.processChunk(self)
690703
# NOTE: this assumes saving the output attributes for each chunk
691704
self.node.saveOutputAttr()
692705
executionStatus = Status.SUCCESS
693706
except Exception:
707+
print(f"(_process) L")
694708
self.updateStatusFromCache() # check if the status has been updated by another process
695709
if self._status.status != Status.STOPPED:
696710
executionStatus = Status.ERROR
697711
raise
698712
except (KeyboardInterrupt, SystemError, GeneratorExit):
713+
print(f"(_process) M")
699714
executionStatus = Status.STOPPED
700715
raise
701716
finally:
717+
print(f"(_process) N")
702718
self._status.setNode(self.node)
703719
self._status.initEndCompute()
704720
self.upgradeStatusFile()
@@ -712,6 +728,7 @@ def _process(self, forceCompute=False, inCurrentEnv=False):
712728
self.statistics = stats.Statistics()
713729
del runningProcesses[self.name]
714730

731+
print(f"(_process) O")
715732

716733
def _processInIsolatedEnvironment(self):
717734
"""

meshroom/core/taskManager.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,13 @@ def run(self):
9595
multiChunks = len(node.chunks) > 1
9696
except TypeError:
9797
continue
98+
9899

100+
print("(tm) A")
99101
node.preprocess()
102+
print("(tm) B")
100103
for cId, chunk in enumerate(node.chunks):
104+
print("(tm) C", cId, chunk)
101105
if chunk.isFinishedOrRunning() or not self.isRunning():
102106
continue
103107

@@ -107,13 +111,17 @@ def run(self):
107111
_nodeName, _node, _nbNodes = node.nodeType, nId+1, len(self._manager._nodesToProcess)
108112

109113
if multiChunks:
114+
print("(tm) D0")
110115
_chunk, _nbChunks = cId+1, len(node.chunks)
111116
logging.info(f"[{_node}/{_nbNodes}]({_chunk}/{_nbChunks}) {_nodeName}")
112117
else:
118+
print("(tm) D1")
113119
logging.info(f"[{_node}/{_nbNodes}] {_nodeName}")
114120
try:
121+
print("(tm) D")
115122
chunk.process(self.forceCompute)
116123
except Exception as exc:
124+
print("(tm) D2")
117125
if chunk.isStopped():
118126
stopAndRestart = True
119127
break
@@ -128,6 +136,7 @@ def run(self):
128136
# Node already removed (for instance a global clear of _nodesToProcess)
129137
pass
130138
n.clearSubmittedChunks()
139+
print("(tm) E")
131140
node.postprocess()
132141

133142
if stopAndRestart:

0 commit comments

Comments
 (0)