Commit 5c3023ae authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[experiment] Add option to make experiment run less verbose

parent 8baa8fbe
Pipeline #21848 passed with stages
in 26 minutes and 58 seconds
......@@ -52,7 +52,7 @@ from .click_helper import AliasedGroup
logger = logging.getLogger(__name__)
def run_experiment(configuration, name, force, use_docker, use_local):
def run_experiment(configuration, name, force, use_docker, use_local, quiet):
'''Run experiments locally'''
def load_result(executor):
......@@ -197,7 +197,7 @@ def run_experiment(configuration, name, force, use_docker, use_local):
if executor.outputs_exist and not force:
logger.info("Skipping execution of `%s' for block `%s' "
"- outputs exist", executor.algorithm.name, key)
if executor.analysis:
if executor.analysis and not quiet:
logger.extra(" Outputs produced:")
print_results(executor)
continue
......@@ -256,15 +256,18 @@ def run_experiment(configuration, name, force, use_docker, use_local):
else:
logger.extra(" Environment: %s" % 'local environment')
if executor.analysis:
print_results(executor)
if not quiet:
if executor.analysis:
print_results(executor)
logger.extra(" Outputs produced:")
if executor.analysis:
logger.extra(" * %s", executor.data['result']['path'])
logger.extra(" Outputs produced:")
if executor.analysis:
logger.extra(" * %s", executor.data['result']['path'])
else:
for name, details in executor.data['outputs'].items():
logger.extra(" * %s", details['path'])
else:
for name, details in executor.data['outputs'].items():
logger.extra(" * %s", details['path'])
logger.info("Done")
return 0
......@@ -556,12 +559,14 @@ def experiments(ctx):
@click.option('--local', help='Uses the local executor to execute the '
'experiment on the local machine (default)',
default=True, is_flag=True)
@click.option('--quiet', help='Be less verbose',
is_flag=True)
@click.pass_context
@raise_on_error
def run(ctx, name, force, docker, local):
def run(ctx, name, force, docker, local, quiet):
''' Runs an experiment locally'''
config = ctx.meta.get('config')
return run_experiment(config, name, force, docker, local or True)
return run_experiment(config, name, force, docker, local, quiet)
@experiments.command()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment