Merge pull request #354 from hartym/339_templates_new_syntax

#339 - Update templates to use new syntax.
This commit is contained in:
Romain Dorgueil
2019-07-20 15:04:37 +02:00
committed by GitHub
3 changed files with 15 additions and 11 deletions

View File

@ -83,6 +83,9 @@ def run(graph, *, plugins=None, services=None, strategy=None):
from bonobo.util.errors import sweeten_errors
if not isinstance(graph, Graph) and hasattr(graph, 'graph'):
graph = graph.graph
with sweeten_errors():
return strategy.execute(graph, plugins=plugins, services=services)

View File

@ -1,16 +1,13 @@
import bonobo
def get_graph(**options):
graph = bonobo.Graph()
graph.get_cursor() >> ...
return graph
def get_services(**options):
return {}
def create_graph():
return (
bonobo.Graph()
>> ...
)
if __name__ == '__main__':
with bonobo.parse_args() as options:
bonobo.run(get_graph(**options), services=get_services(**options))
bonobo.run(create_graph())

View File

@ -27,8 +27,12 @@ def get_graph(**options):
"""
graph = bonobo.Graph()
graph.get_cursor() >> extract >> transform >> load
(
graph
>> extract
>> transform
>> load
)
return graph