summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2015-03-16 18:57:23 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2015-07-01 06:04:31 +0000
commit2b827e1e363a90e4037172ccb0d57ac0873497fb (patch)
tree667c8cced86cfcdedec3678315ee3a796b058f43 /tools
parente012d8de0c828c9f9037752dd0377012a638bca3 (diff)
downloadtaskflow-2b827e1e363a90e4037172ccb0d57ac0873497fb.tar.gz
Add support for conditional execution
To make it possible to alter the runtime flow via a simple conditional like structure make it possible to have the graph flow link function take a decider that is expected to be some callable that will decide (via a boolean return) whether the edge should actually be traversed when running. When a decider returns false; the affected + successors will be set into the IGNORE state and they will be exempt from future runtime and scheduling decisions. Part of blueprint taskflow-conditional-execution Change-Id: Iab0ee46f86d6b8e747911174d54a7295b3fa404d
Diffstat (limited to 'tools')
-rwxr-xr-xtools/state_graph.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/state_graph.py b/tools/state_graph.py
index 997920d..c37cd70 100755
--- a/tools/state_graph.py
+++ b/tools/state_graph.py
@@ -14,6 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import mock
+
import optparse
import os
import sys
@@ -37,10 +39,10 @@ from taskflow.types import fsm
# actually be running it...).
class DummyRuntime(object):
def __init__(self):
- self.analyzer = None
- self.completer = None
- self.scheduler = None
- self.storage = None
+ self.analyzer = mock.MagicMock()
+ self.completer = mock.MagicMock()
+ self.scheduler = mock.MagicMock()
+ self.storage = mock.MagicMock()
def clean_event(name):
@@ -130,7 +132,7 @@ def main():
list(states._ALLOWED_RETRY_TRANSITIONS))
elif options.engines:
source_type = "Engines"
- r = runner.Runner(DummyRuntime(), None)
+ r = runner.Runner(DummyRuntime(), mock.MagicMock())
source, memory = r.build()
internal_states.extend(runner._META_STATES)
ordering = 'out'