Bases: exceptions.Exception
Extension of exception class.
A segment oriented graph.
A pipeline is a list of code segments with their corresponding repository and dependency tree.
Setting matplotlib to True will turn the matplotlib backend to Agg in order to allow the execution in non-interactive environment.
Return a generator delivering segments in execution order.
Perform a topological sort of the dependency graph. For this to succeed the graph MUST be acyclic.
Iterative algorithm from Kahn (1962) http://en.wikipedia.org/wiki/Topological_sorting
>>> T = Pipeline('''first->second->fourth;
... third->fourth;''', permissive=True)
>>> for e in T.flatten():
... print e
third
first
second
fourth
Parse a subset of the graphviz dot language.
>>> p = Pipeline('')
>>> p.from_dot('a;')
>>> print p._parents == {'a':[]}, p._children == {'a':[]}
True True
>>> p.from_dot('''a->b;
... c->b;
... c->d;''')
>>> print p._children
{'a': ['b'], 'c': ['b', 'd'], 'b': [], 'd': []}
>>> print p._parents
{'a': [], 'c': [], 'b': ['a', 'c'], 'd': ['c']}
Return the data directory for the segment or a product full name.
Return the meta data filename
This routine is called for segment meta data storage and task meta data storage.
If the first case, meta data are stored in the segment curr_dir.
In the second case, meta data are stored in the task directory (prod may be None)
Return a list of parent segments.
>>> a = Pipeline('''first->second->fourth
... third->fourth''',
... permissive=True)
>>> print(a.get_parents('fourth'))
['second', 'third']