From d35598fe8ca1ea85267c475d4dc1e60a846e6786 Mon Sep 17 00:00:00 2001 From: Romain Dorgueil Date: Mon, 2 Oct 2017 08:57:46 +0200 Subject: [PATCH] Add a reference to graph context (private) in service container. --- bonobo/execution/graph.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bonobo/execution/graph.py b/bonobo/execution/graph.py index 00d2c43..2c08589 100644 --- a/bonobo/execution/graph.py +++ b/bonobo/execution/graph.py @@ -25,6 +25,9 @@ class GraphExecutionContext: self.plugins = [PluginExecutionContext(plugin, parent=self) for plugin in plugins or ()] self.services = Container(services) if services else Container() + # Probably not a good idea to use it unless you really know what you're doing. But you can access the context. + self.services['__graph_context'] = self + for i, node_context in enumerate(self): node_context.outputs = [self[j].input for j in self.graph.outputs_of(i)] node_context.input.on_begin = partial(node_context.send, BEGIN, _control=True)