Add a reference to graph context (private) in service container.

This commit is contained in:
Romain Dorgueil
2017-10-02 08:57:46 +02:00
parent c09c101074
commit d35598fe8c

View File

@ -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)