mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-24 22:46:28 +02:00
[core] check RUNNING status in chunk compute function and add option to force computation
This commit is contained in:
parent
a92a6f6df9
commit
e3815f74c7
2 changed files with 19 additions and 14 deletions
|
@ -50,15 +50,9 @@ if args.node:
|
||||||
# exit(-1)
|
# exit(-1)
|
||||||
if args.iteration != -1:
|
if args.iteration != -1:
|
||||||
chunk = node.chunks[args.iteration]
|
chunk = node.chunks[args.iteration]
|
||||||
if chunk.status.status != Status.SUCCESS or args.forceCompute:
|
chunk.process(args.forceCompute)
|
||||||
chunk.process()
|
|
||||||
else:
|
else:
|
||||||
print('Node chunk is already successfully computed. Nothing to do.')
|
node.process(args.forceCompute)
|
||||||
else:
|
|
||||||
if not node.hasStatus(Status.SUCCESS) or args.forceCompute:
|
|
||||||
node.process()
|
|
||||||
else:
|
|
||||||
print('Node is already successfully computed. Nothing to do.')
|
|
||||||
else:
|
else:
|
||||||
if args.iteration != -1:
|
if args.iteration != -1:
|
||||||
print('Error: "--iteration" only make sense when used with "--node".')
|
print('Error: "--iteration" only make sense when used with "--node".')
|
||||||
|
|
|
@ -570,7 +570,10 @@ class NodeChunk(BaseObject):
|
||||||
def isAlreadySubmitted(self):
|
def isAlreadySubmitted(self):
|
||||||
return self.status.status in (Status.SUBMITTED_EXTERN, Status.SUBMITTED_LOCAL, Status.RUNNING)
|
return self.status.status in (Status.SUBMITTED_EXTERN, Status.SUBMITTED_LOCAL, Status.RUNNING)
|
||||||
|
|
||||||
def process(self):
|
def process(self, forceCompute=False):
|
||||||
|
if not forceCompute and self.status.status == Status.SUCCESS:
|
||||||
|
print("Node chunk already computed:", self.name)
|
||||||
|
return
|
||||||
global runningProcesses
|
global runningProcesses
|
||||||
runningProcesses[self.name] = self
|
runningProcesses[self.name] = self
|
||||||
self.upgradeStatusTo(Status.RUNNING)
|
self.upgradeStatusTo(Status.RUNNING)
|
||||||
|
@ -845,9 +848,9 @@ class Node(BaseObject):
|
||||||
def processIteration(self, iteration):
|
def processIteration(self, iteration):
|
||||||
self.chunks[iteration].process()
|
self.chunks[iteration].process()
|
||||||
|
|
||||||
def process(self):
|
def process(self, forceCompute=False):
|
||||||
for chunk in self.chunks:
|
for chunk in self.chunks:
|
||||||
chunk.process()
|
chunk.process(forceCompute)
|
||||||
|
|
||||||
def endSequence(self):
|
def endSequence(self):
|
||||||
pass
|
pass
|
||||||
|
@ -1437,10 +1440,18 @@ def execute(graph, toNodes=None, forceCompute=False, forceStatus=False):
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
node.beginSequence()
|
node.beginSequence()
|
||||||
|
|
||||||
for i, node in enumerate(nodes):
|
for n, node in enumerate(nodes):
|
||||||
try:
|
try:
|
||||||
print('\n[{i}/{N}] {nodeName}'.format(i=i + 1, N=len(nodes), nodeName=node.nodeType))
|
multiChunks = len(node.chunks) > 1
|
||||||
node.process()
|
for c, chunk in enumerate(node.chunks):
|
||||||
|
if multiChunks:
|
||||||
|
print('\n[{node}/{nbNodes}]({chunk}/{nbChunks}) {nodeName}'.format(
|
||||||
|
node=n+1, nbNodes=len(nodes),
|
||||||
|
chunk=c+1, nbChunks=len(node.chunks), nodeName=node.nodeType))
|
||||||
|
else:
|
||||||
|
print('\n[{node}/{nbNodes}] {nodeName}'.format(
|
||||||
|
node=n + 1, nbNodes=len(nodes), nodeName=node.nodeType))
|
||||||
|
chunk.process(forceCompute)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error("Error on node computation: {}".format(e))
|
logging.error("Error on node computation: {}".format(e))
|
||||||
graph.clearSubmittedNodes()
|
graph.clearSubmittedNodes()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue