From 56c26ea26cd63ad83ea997cb6fbc75ac62ee522e Mon Sep 17 00:00:00 2001 From: Romain Dorgueil Date: Sun, 5 Nov 2017 14:54:01 +0100 Subject: [PATCH] Fix default logging level, adds options to default template. --- bonobo/commands/__init__.py | 1 + bonobo/commands/templates/default.py-tpl | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bonobo/commands/__init__.py b/bonobo/commands/__init__.py index f42d5c6..a482b53 100644 --- a/bonobo/commands/__init__.py +++ b/bonobo/commands/__init__.py @@ -16,6 +16,7 @@ def entrypoint(args=None): mondrian.setup(excepthook=True) logger = logging.getLogger() + logger.setLevel(settings.LOGGING_LEVEL.get()) parser = argparse.ArgumentParser() parser.add_argument('--debug', '-D', action='store_true') diff --git a/bonobo/commands/templates/default.py-tpl b/bonobo/commands/templates/default.py-tpl index c72efb5..eaea053 100644 --- a/bonobo/commands/templates/default.py-tpl +++ b/bonobo/commands/templates/default.py-tpl @@ -19,7 +19,7 @@ def load(*args): print(*args) -def get_graph(): +def get_graph(**options): """ This function builds the graph that needs to be executed. @@ -32,7 +32,7 @@ def get_graph(): return graph -def get_services(): +def get_services(**options): """ This function builds the services dictionary, which is a simple dict of names-to-implementation used by bonobo for runtime injection. @@ -48,5 +48,8 @@ def get_services(): # The __main__ block actually execute the graph. if __name__ == '__main__': parser = bonobo.get_argument_parser() - with bonobo.parse_args(parser): - bonobo.run(get_graph(), services=get_services()) + with bonobo.parse_args(parser) as options: + bonobo.run( + get_graph(**options), + services=get_services(**options) + )