Meshroom/bin/meshroom_compute
2017-10-26 12:22:06 +02:00

39 lines
1.4 KiB
Python
Executable file

#!/usr/bin/env python
import argparse
from meshroom.core import graph as pg
parser = argparse.ArgumentParser(description='Execute 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. It will generate an error if the dependencies are not already computed.')
parser.add_argument('--toNode', metavar='NODE_NAME', type=str,
help='Process the node with its dependencies.')
parser.add_argument("--force", help="Force recompute",
action="store_true")
parser.add_argument('--cache', metavar='FOLDER', type=str,
default=None,
help='Override the cache folder')
args = parser.parse_args()
graph = pg.loadGraph(args.graphFile)
if args.cache:
graph.cacheDir = args.cache
graph.update()
if args.node:
# Execute the node
node = graph.node(args.node)
if node.isAlreadySubmitted():
print('Error: Node is already submitted with status "{}"'.format(node.status.status.name))
exit(-1)
if args.force or node.status.status != pg.Status.SUCCESS:
node.process()
else:
toNodes = None
if args.toNode:
toNodes = graph.findNodes(args.toNode)
pg.execute(graph, toNodes=toNodes, force=args.force)