diff options
| author | Joshua Harlow <harlowja@yahoo-inc.com> | 2014-07-18 12:22:00 -0700 |
|---|---|---|
| committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2014-09-08 19:14:51 +0000 |
| commit | e68d72f66e387f5b9f9a543d8ac3000ef5cfbbdc (patch) | |
| tree | 5c3da03c0936e6631752f9408ec0570c3382e6dd /taskflow/patterns/linear_flow.py | |
| parent | e1ef04492ebddab02de2f277079ae0c7448c3b40 (diff) | |
| download | taskflow-e68d72f66e387f5b9f9a543d8ac3000ef5cfbbdc.tar.gz | |
Be smarter about required flow symbols
Instead of blindly assuming all the symbols that
are provided automatically work for all flows even
if the flow has ordering constraints we should set
the base flow class requires property to be abstract
and provide flow specific properties that can do the
appropriate analysis to determine what the flows
unsatisfied symbol requirements actually are.
Part of blueprint taskflow-improved-scoping
Change-Id: Ie149c05b3305c5bfff9d9f2c05e7e064c3a6d0c7
Diffstat (limited to 'taskflow/patterns/linear_flow.py')
| -rw-r--r-- | taskflow/patterns/linear_flow.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/taskflow/patterns/linear_flow.py b/taskflow/patterns/linear_flow.py index 48b4d3c..14799b8 100644 --- a/taskflow/patterns/linear_flow.py +++ b/taskflow/patterns/linear_flow.py @@ -74,7 +74,18 @@ class Flow(flow.Flow): for child in self._children: yield child + @property + def requires(self): + requires = set() + prior_provides = set() + if self._retry is not None: + requires.update(self._retry.requires) + prior_provides.update(self._retry.provides) + for item in self: + requires.update(item.requires - prior_provides) + prior_provides.update(item.provides) + return frozenset(requires) + def iter_links(self): - for src, dst in zip(self._children[:-1], - self._children[1:]): + for src, dst in zip(self._children[:-1], self._children[1:]): yield (src, dst, _LINK_METADATA.copy()) |
