summaryrefslogtreecommitdiff
path: root/taskflow/patterns/graph_flow.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2013-07-10 00:00:04 -0700
committerJoshua Harlow <harlowja@gmail.com>2013-07-10 00:00:04 -0700
commit81d0884d556928ff14054878112bfbb8229931e6 (patch)
treee5f2b4d493fa8737f10a98fc371e5606a7e1e5da /taskflow/patterns/graph_flow.py
parent37edf7d4ff80640d766f93b2def264e7b4b6831f (diff)
downloadtaskflow-81d0884d556928ff14054878112bfbb8229931e6.tar.gz
Provide the length of the flows.
Its useful to be able to check if a flow contains anything by just inspecting the len() of the flow. This can be used to avoid running a flow in the first place if nothing is in said flow. Change-Id: Ibfea7f10fc67d5dd3ddfa6f6fe6c08805562998a
Diffstat (limited to 'taskflow/patterns/graph_flow.py')
-rw-r--r--taskflow/patterns/graph_flow.py3
1 files changed, 3 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