Fix default logging level, adds options to default template.

This commit is contained in:
Romain Dorgueil
2017-11-05 14:54:01 +01:00
parent 674f9348e7
commit 56c26ea26c
2 changed files with 8 additions and 4 deletions

View File

@ -16,6 +16,7 @@ def entrypoint(args=None):
mondrian.setup(excepthook=True) mondrian.setup(excepthook=True)
logger = logging.getLogger() logger = logging.getLogger()
logger.setLevel(settings.LOGGING_LEVEL.get())
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--debug', '-D', action='store_true') parser.add_argument('--debug', '-D', action='store_true')

View File

@ -19,7 +19,7 @@ def load(*args):
print(*args) print(*args)
def get_graph(): def get_graph(**options):
""" """
This function builds the graph that needs to be executed. This function builds the graph that needs to be executed.
@ -32,7 +32,7 @@ def get_graph():
return 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 This function builds the services dictionary, which is a simple dict of names-to-implementation used by bonobo
for runtime injection. for runtime injection.
@ -48,5 +48,8 @@ def get_services():
# The __main__ block actually execute the graph. # The __main__ block actually execute the graph.
if __name__ == '__main__': if __name__ == '__main__':
parser = bonobo.get_argument_parser() parser = bonobo.get_argument_parser()
with bonobo.parse_args(parser): with bonobo.parse_args(parser) as options:
bonobo.run(get_graph(), services=get_services()) bonobo.run(
get_graph(**options),
services=get_services(**options)
)