summaryrefslogtreecommitdiff
path: root/taskflow/patterns
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-03-24 11:03:10 +0000
committerGerrit Code Review <review@openstack.org>2014-03-24 11:03:10 +0000
commitce12f36e56be95feadeb2fb72ca56411500374bd (patch)
treeed30d416c5c42c2bc118680e5a032a4f4aad10e8 /taskflow/patterns
parentf16837569785cc4bb53149192fe88869b6aff7d3 (diff)
parent261d69a75915f869b2e7bf351c47f202c725837c (diff)
downloadtaskflow-ce12f36e56be95feadeb2fb72ca56411500374bd.tar.gz
Merge "Rework graph flow unit tests"
Diffstat (limited to 'taskflow/patterns')
-rw-r--r--taskflow/patterns/graph_flow.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/taskflow/patterns/graph_flow.py b/taskflow/patterns/graph_flow.py
index a835e0b..decf356 100644
--- a/taskflow/patterns/graph_flow.py
+++ b/taskflow/patterns/graph_flow.py
@@ -41,16 +41,6 @@ class Flow(flow.Flow):
super(Flow, self).__init__(name, retry)
self._graph = nx.freeze(nx.DiGraph())
- def _validate(self, graph=None):
- if graph is None:
- graph = self._graph
- # Ensure that there is a valid topological ordering.
- if not nx.is_directed_acyclic_graph(graph):
- raise exc.DependencyFailure("No path through the items in the"
- " graph produces an ordering that"
- " will allow for correct dependency"
- " resolution")
-
def link(self, u, v):
"""Link existing node u as a runtime dependency of existing node v."""
if not self._graph.has_node(u):
@@ -86,7 +76,11 @@ class Flow(flow.Flow):
with a frozen version of the replacement graph (this maintains the
invariant that the underlying graph is immutable).
"""
- self._validate(replacement_graph)
+ if not nx.is_directed_acyclic_graph(replacement_graph):
+ raise exc.DependencyFailure("No path through the items in the"
+ " graph produces an ordering that"
+ " will allow for correct dependency"
+ " resolution")
self._graph = nx.freeze(replacement_graph)
def add(self, *items):