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
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user