summaryrefslogtreecommitdiff
path: root/tools/state_graph.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2014-04-12 21:35:16 -0700
committerJoshua Harlow <harlowja@gmail.com>2014-04-20 17:28:27 -0700
commit5ca61f956e588d8a088d78bc9a58b2904acfb416 (patch)
tree26f5fb1c1542423f7bf5c2c4cc0ab3c20f77d150 /tools/state_graph.py
parent963330242f773eaa1dda6eac07b470ac75eabf51 (diff)
downloadtaskflow-5ca61f956e588d8a088d78bc9a58b2904acfb416.tar.gz
Add a directed graph type (new types module)
Most of the utility graph functions we have can be connected to a directed graph class that itself derives (and adds on to) the networkx base class. Doing this allows for functionality that isn't exposed in networkx to be exposed in our subclass (which is a useful pattern to have). It also makes it possible (if ever needed) to replace the networkx usage in taskflow with something else if this ever becomes a major request. Change-Id: I0a825d5637236d7b5dbdbda0d426adb0183d5ba3
Diffstat (limited to 'tools/state_graph.py')
-rw-r--r--tools/state_graph.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/tools/state_graph.py b/tools/state_graph.py
index 4a2587c..f6a2057 100644
--- a/tools/state_graph.py
+++ b/tools/state_graph.py
@@ -11,10 +11,8 @@ import optparse
import subprocess
import tempfile
-import networkx as nx
-
from taskflow import states
-from taskflow.utils import graph_utils as gu
+from taskflow.types import graph as gr
def mini_exec(cmd, ok_codes=(0,)):
@@ -31,7 +29,7 @@ def mini_exec(cmd, ok_codes=(0,)):
def make_svg(graph, output_filename, output_format):
# NOTE(harlowja): requires pydot!
- gdot = gu.export_graph_to_dot(graph)
+ gdot = graph.export_to_dot()
if output_format == 'dot':
output = gdot
elif output_format in ('svg', 'svgz', 'png'):
@@ -62,7 +60,7 @@ def main():
if options.filename is None:
options.filename = 'states.%s' % options.format
- g = nx.DiGraph(name="State transitions")
+ g = gr.DiGraph(name="State transitions")
if not options.tasks:
source = states._ALLOWED_FLOW_TRANSITIONS
else: