forked from openphotogrammetry/meshroomcl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeshroom_status
executable file
·52 lines (43 loc) · 1.68 KB
/
meshroom_status
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python
import argparse
import os
import sys
from pprint import pprint
import meshroom
meshroom.setupEnvironment()
import meshroom.core.graph
parser = argparse.ArgumentParser(description='Query the status of nodes in a Graph of processes.')
parser.add_argument('graphFile', metavar='GRAPHFILE.mg', type=str,
help='Filepath to a graph file.')
parser.add_argument('--node', metavar='NODE_NAME', type=str,
help='Process the node alone.')
parser.add_argument('--toNode', metavar='NODE_NAME', type=str,
help='Process the node and all previous nodes needed.')
parser.add_argument("--verbose", help="Print full status information",
action="store_true")
args = parser.parse_args()
if not os.path.exists(args.graphFile):
print('ERROR: No graph file "{}".'.format(args.node, args.graphFile))
sys.exit(-1)
graph = meshroom.core.graph.loadGraph(args.graphFile)
graph.update()
if args.node:
node = graph.node(args.node)
if node is None:
print('ERROR: node "{}" does not exist in file "{}".'.format(args.node, args.graphFile))
sys.exit(-1)
for chunk in node.chunks:
print('{}: {}'.format(chunk.name, chunk.status.status.name))
if args.verbose:
print('statusFile: ', node.statusFile)
pprint(node.status.toDict())
else:
startNodes = None
if args.toNode:
startNodes = [graph.nodes(args.toNode)]
nodes, edges = graph.dfsOnFinish(startNodes=startNodes)
for node in nodes:
for chunk in node.chunks:
print('{}: {}'.format(chunk.name, chunk.status.status.name))
if args.verbose:
pprint([n.status.toDict() for n in nodes])