From 5cab4effeac1c1fe7b7f8dce5c93ae9ba608f63b Mon Sep 17 00:00:00 2001 From: Ben Rudolph Date: Fri, 23 Mar 2018 17:45:47 -0700 Subject: [PATCH] allow for overriding strategy --- bonobo/contrib/django/commands.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bonobo/contrib/django/commands.py b/bonobo/contrib/django/commands.py index 4edcd09..ac5f387 100644 --- a/bonobo/contrib/django/commands.py +++ b/bonobo/contrib/django/commands.py @@ -41,6 +41,9 @@ class ETLCommand(BaseCommand): def get_services(self): return {} + def get_strategy(self): + return None + def info(self, *args, **kwargs): self.logger.info(*args, **kwargs) @@ -48,6 +51,7 @@ class ETLCommand(BaseCommand): results = [] with bonobo.parse_args(options) as options: services = self.get_services() + strategy = self.get_strategy() graph_coll = self.get_graph(*args, **options) if not isinstance(graph_coll, GeneratorType): @@ -56,7 +60,7 @@ class ETLCommand(BaseCommand): for i, graph in enumerate(graph_coll): assert isinstance(graph, bonobo.Graph), 'Invalid graph provided.' print(term.lightwhite('{}. {}'.format(i + 1, graph.name))) - result = bonobo.run(graph, services=services) + result = bonobo.run(graph, services=services, strategy=strategy) results.append(result) print(term.lightblack(' ... return value: ' + str(result))) print()