mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-28 17:57:16 +02:00
[bin] meshroom_compute: verbosity
- add option to control verbosity - in extern mode: disable logging and enable it only for the node computation (to avoid polluting the node's log with general warnings)
This commit is contained in:
parent
66fb8134c9
commit
ad1d97f202
1 changed files with 25 additions and 0 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Reference in a new issue