summaryrefslogtreecommitdiff
path: root/taskflow/patterns
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-07-24 05:53:44 +0000
committerGerrit Code Review <review@openstack.org>2013-07-24 05:53:44 +0000
commit6750ed5f2c476fde0ffdeb91a9e0d4c4bc9589c1 (patch)
treef00216fe934ffa5702a801b9675bd2b210012e9c /taskflow/patterns
parent1c99d9c32240cddb8b3b001f77d3de3e6c8fd9b6 (diff)
parent81d0884d556928ff14054878112bfbb8229931e6 (diff)
downloadtaskflow-6750ed5f2c476fde0ffdeb91a9e0d4c4bc9589c1.tar.gz
Merge "Provide the length of the flows."
Diffstat (limited to 'taskflow/patterns')
-rw-r--r--taskflow/patterns/graph_flow.py3
-rw-r--r--taskflow/patterns/linear_flow.py3
2 files changed, 6 insertions, 0 deletions
diff --git a/taskflow/patterns/graph_flow.py b/taskflow/patterns/graph_flow.py
index 46c7394..7e051db 100644
--- a/taskflow/patterns/graph_flow.py
+++ b/taskflow/patterns/graph_flow.py
@@ -61,6 +61,9 @@ class Flow(linear_flow.Flow):
break
return runner
+ def __len__(self):
+ return len(self._graph)
+
@decorators.locked
def add_dependency(self, provider_uuid, requirer_uuid):
"""Connects provider to requirer where provider will now be required
diff --git a/taskflow/patterns/linear_flow.py b/taskflow/patterns/linear_flow.py
index c64635d..96ef74e 100644
--- a/taskflow/patterns/linear_flow.py
+++ b/taskflow/patterns/linear_flow.py
@@ -120,6 +120,9 @@ class Flow(base.Flow):
except (IndexError, ValueError):
pass
+ def __len__(self):
+ return len(self._runners)
+
def _connect(self):
if self._connected:
return self._runners