celery.utils.graph¶
Dependency graph implementation.
- 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.
- items()¶
- iteritems()¶
- to_dot(fh, formatter=None)[源代码]¶
Convert the graph to DOT format.
- 参数:
fh (IO) -- A file, or a file-like object to write the graph to.
formatter (celery.utils.graph.GraphFormatter) -- Custom graph formatter to use.
- class celery.utils.graph.GraphFormatter(root=None, type=None, id=None, indent=0, inw=' ', **scheme)[源代码]¶
Format dependency graphs.
- edge_scheme = {'arrowcolor': 'black', 'arrowsize': 0.7, 'color': 'darkseagreen4'}¶
- graph_scheme = {'bgcolor': 'mintcream'}¶
- node_scheme = {'color': 'palegreen4', 'fillcolor': 'palegreen3'}¶
- scheme = {'arrowhead': 'vee', 'fontname': 'HelveticaNeue', 'shape': 'box', 'style': 'filled'}¶
- term_scheme = {'color': 'palegreen2', 'fillcolor': 'palegreen1'}¶