diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2015-09-04 13:14:25 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@gmail.com> | 2015-10-01 22:38:30 -0700 |
commit | 79d25e69e8300db5debdfd717ffd80f91c246c10 (patch) | |
tree | 134e9764a021dc190a1b158fb27f222d9304908e /taskflow/tests/unit/action_engine/test_builder.py | |
parent | ba4704cd18ab6d799a2de59bdf0feab9b5430a30 (diff) | |
download | taskflow-1.22.0.tar.gz |
Simplify flow action engine compilation1.22.0
Instead of the added complexity of discarding flow nodes
we can simplify the compilation process by just retaining
them and jumping over them in further iteration and graph
and tree runtime usage.
This change moves toward a model that does just this, which
makes it also easier to in the future use the newly added
flow graph nodes to do meaningful things (like use them as
a point to change which flow_detail is used).
Change-Id: Icb1695f4b995a0392f940837514774768f222db4
Diffstat (limited to 'taskflow/tests/unit/action_engine/test_builder.py')
-rw-r--r-- | taskflow/tests/unit/action_engine/test_builder.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/taskflow/tests/unit/action_engine/test_builder.py b/taskflow/tests/unit/action_engine/test_builder.py index b406744..08877f8 100644 --- a/taskflow/tests/unit/action_engine/test_builder.py +++ b/taskflow/tests/unit/action_engine/test_builder.py @@ -37,18 +37,19 @@ class BuildersTest(test.TestCase): compilation = compiler.PatternCompiler(flow).compile() flow_detail = pu.create_flow_detail(flow) store = storage.Storage(flow_detail) - # This ensures the tasks exist in storage... - for task in compilation.execution_graph: - store.ensure_atom(task) + nodes_iter = compilation.execution_graph.nodes_iter(data=True) + for node, node_attrs in nodes_iter: + if node_attrs['kind'] in ('task', 'retry'): + store.ensure_atom(node) if initial_state: store.set_flow_state(initial_state) - task_notifier = notifier.Notifier() + atom_notifier = notifier.Notifier() task_executor = executor.SerialTaskExecutor() retry_executor = executor.SerialRetryExecutor() task_executor.start() self.addCleanup(task_executor.stop) r = runtime.Runtime(compilation, store, - task_notifier, task_executor, + atom_notifier, task_executor, retry_executor) r.compile() return r @@ -305,6 +306,6 @@ class BuildersTest(test.TestCase): self.assertEqual(1, occurrences.get((builder.GAME_OVER, st.SUCCESS))) self.assertEqual(1, occurrences.get((builder.UNDEFINED, st.RESUMING))) - self.assertEqual(0, len(memory.next_nodes)) + self.assertEqual(0, len(memory.next_up)) self.assertEqual(0, len(memory.not_done)) self.assertEqual(0, len(memory.failures)) |