celery.utils.graph

Dependency graph implementation.

exception celery.utils.graph.CycleError[исходный код]

A cycle was detected in an acyclic graph.

class celery.utils.graph.DOT[исходный код]

Constants related to the dot format.

ATTR = '{name}={value}'
ATTRSEP = ', '
DIRS = {'digraph': '->', 'graph': '--'}
EDGE = '{INp}"{0}" {dir} "{1}" [{attrs}]'
HEAD = '\n{IN}{type} {id} {{\n{INp}graph [{attrs}]\n'
NODE = '{INp}"{0}" [{attrs}]'
TAIL = '{IN}}}'
class celery.utils.graph.DependencyGraph(it=None, formatter=None)[исходный код]

A directed acyclic graph of objects and their dependencies.

Supports a robust topological sort to detect the order in which they must be handled.

Takes an optional iterator of (obj, dependencies) tuples to build the graph from.

Предупреждение

Does not support cycle detection.

add_arc(obj)[исходный код]

Add an object to the graph.

add_edge(A, B)[исходный код]

Add an edge from object A to object B.

I.e. A depends on B.

connect(graph)[исходный код]

Add nodes from another graph.

edges()[исходный код]

Return generator that yields for all edges in the graph.

format(obj)[исходный код]
items()
iteritems()
repr_node(obj, level=1, fmt='{0}({1})')[исходный код]
to_dot(fh, formatter=None)[исходный код]

Convert the graph to DOT format.

Параметры:
topsort()[исходный код]

Sort the graph topologically.

Результат:

of objects in the order in which they must be handled.

Тип результата:

List

update(it)[исходный код]

Update graph with data from a list of (obj, deps) tuples.

valency_of(obj)[исходный код]

Return the valency (degree) of a vertex in the graph.

class celery.utils.graph.GraphFormatter(root=None, type=None, id=None, indent=0, inw='    ', **scheme)[исходный код]

Format dependency graphs.

FMT(fmt, *args, **kwargs)[исходный код]
attr(name, value)[исходный код]
attrs(d, scheme=None)[исходный код]
draw_edge(a, b, scheme=None, attrs=None)[исходный код]
draw_node(obj, scheme=None, attrs=None)[исходный код]
edge(a, b, **attrs)[исходный код]
edge_scheme = {'arrowcolor': 'black', 'arrowsize': 0.7, 'color': 'darkseagreen4'}
graph_scheme = {'bgcolor': 'mintcream'}
head(**attrs)[исходный код]
label(obj)[исходный код]
node(obj, **attrs)[исходный код]
node_scheme = {'color': 'palegreen4', 'fillcolor': 'palegreen3'}
scheme = {'arrowhead': 'vee', 'fontname': 'HelveticaNeue', 'shape': 'box', 'style': 'filled'}
tail()[исходный код]
term_scheme = {'color': 'palegreen2', 'fillcolor': 'palegreen1'}
terminal_node(obj, **attrs)[исходный код]
Back to Top