#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
|
from bonobo.util.errors import sweeten_errors
|
||||||
|
|
||||||
|
if not isinstance(graph, Graph) and hasattr(graph, 'graph'):
|
||||||
|
graph = graph.graph
|
||||||
|
|
||||||
with sweeten_errors():
|
with sweeten_errors():
|
||||||
return strategy.execute(graph, plugins=plugins, services=services)
|
return strategy.execute(graph, plugins=plugins, services=services)
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,13 @@
|
|||||||
import bonobo
|
import bonobo
|
||||||
|
|
||||||
|
|
||||||
def get_graph(**options):
|
def create_graph():
|
||||||
graph = bonobo.Graph()
|
return (
|
||||||
graph.get_cursor() >> ...
|
bonobo.Graph()
|
||||||
return graph
|
>> ...
|
||||||
|
)
|
||||||
|
|
||||||
def get_services(**options):
|
|
||||||
return {}
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
with bonobo.parse_args() as options:
|
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 = bonobo.Graph()
|
||||||
graph.get_cursor() >> extract >> transform >> load
|
(
|
||||||
|
graph
|
||||||
|
>> extract
|
||||||
|
>> transform
|
||||||
|
>> load
|
||||||
|
)
|
||||||
return graph
|
return graph
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user