diff --git a/bin/meshroom_compute b/bin/meshroom_compute index d5612a5b..208152fe 100755 --- a/bin/meshroom_compute +++ b/bin/meshroom_compute @@ -1,5 +1,7 @@ #!/usr/bin/env python import argparse +import logging +import os import sys try: @@ -12,6 +14,7 @@ except: import meshroom meshroom.setupEnvironment() +import meshroom.core import meshroom.core.graph from meshroom.core.node import Status @@ -32,12 +35,30 @@ parser.add_argument('--extern', help='Use this option when you compute externall parser.add_argument('--cache', metavar='FOLDER', type=str, default=None, help='Override the cache folder') +parser.add_argument('-v', '--verbose', + help='Set the verbosity level for logging:\n' + ' - fatal: Show only critical errors.\n' + ' - error: Show errors only.\n' + ' - warning: Show warnings and errors.\n' + ' - info: Show standard informational messages.\n' + ' - debug: Show detailed debug information.\n' + ' - trace: Show all messages, including trace-level details.', + default=os.environ.get('MESHROOM_VERBOSE', 'info'), + choices=['fatal', 'error', 'warning', 'info', 'debug', 'trace']) parser.add_argument('-i', '--iteration', type=int, default=-1, help='') args = parser.parse_args() +# Setup the verbose level +if args.extern: + # For extern computation, we want to focus on the node computation log. + # So, we avoid polluting the log with general warning about plugins, versions of nodes in file, etc. + logging.getLogger().setLevel(level=logging.ERROR) +else: + logging.getLogger().setLevel(meshroom.logStringToPython[args.verbose]) + meshroom.core.initNodes() graph = meshroom.core.graph.loadGraph(args.graphFile) @@ -63,6 +84,10 @@ if args.node: print('Warning: Node is already submitted with status "{}". See file: "{}"'.format(chunk.status.status.name, chunk.statusFile)) # sys.exit(-1) + if args.extern: + # Restore the log level + logging.getLogger().setLevel(meshroom.logStringToPython[args.verbose]) + node.preprocess() if args.iteration != -1: chunk = node.chunks[args.iteration]