Merge pull request #354 from hartym/339_templates_new_syntax
#339 - Update templates to use new syntax.
This commit is contained in:
@ -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)
|
||||
|
||||
|
||||
@ -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())
|
||||
|
||||
@ -27,8 +27,12 @@ def get_graph(**options):
|
||||
|
||||
"""
|
||||
graph = bonobo.Graph()
|
||||
graph.get_cursor() >> extract >> transform >> load
|
||||
|
||||
(
|
||||
graph
|
||||
>> extract
|
||||
>> transform
|
||||
>> load
|
||||
)
|
||||
return graph
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user