Skip to content

Instantly share code, notes, and snippets.

@hartym
Created May 17, 2018 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hartym/38150bc043eb8b124c62d1baa34a53c4 to your computer and use it in GitHub Desktop.
Save hartym/38150bc043eb8b124c62d1baa34a53c4 to your computer and use it in GitHub Desktop.
from contextlib import contextmanager
import bonobo
def get_graph(**options):
graph = bonobo.Graph([1,2,3], bonobo.PrettyPrinter())
return graph
@contextmanager
def get_services(**options):
try:
s = 'ftp'
yield {'ftp': s}
finally:
print('closing {}'.format(s))
if __name__ == '__main__':
with bonobo.parse_args() as options:
with get_services(**options) as services:
bonobo.run(get_graph(**options), services=services)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment