Meshroom/bin/meshroom_status
Candice Bentéjac be4c02f515 [bin] Fix all the scripts that had errors
- `meshroom_submit`: the submission to the render farm is now effective
(the script did not work at all).
- `meshroom_status`: the `--toNode` option did not work and caused errors.
- `meshroom_statistics`: some adjustments needed to be made for the script
to run with Python3 instead of Python2, an issue in the core/stats.py file
led the `statistics` file to never being read correctly, and the calls
to the Matplotlib API were outdated.
2023-04-24 16:43:01 +02:00

51 lines
1.7 KiB
Python
Executable file

#!/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.findNode(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])