taskflow 5.12.0__py3-none-any.whl → 6.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- taskflow/atom.py +3 -5
- taskflow/conductors/backends/__init__.py +0 -2
- taskflow/conductors/backends/impl_blocking.py +1 -3
- taskflow/conductors/backends/impl_executor.py +3 -6
- taskflow/conductors/backends/impl_nonblocking.py +1 -3
- taskflow/conductors/base.py +1 -3
- taskflow/deciders.py +0 -2
- taskflow/engines/__init__.py +0 -2
- taskflow/engines/action_engine/actions/base.py +1 -3
- taskflow/engines/action_engine/actions/retry.py +1 -3
- taskflow/engines/action_engine/actions/task.py +1 -3
- taskflow/engines/action_engine/builder.py +2 -4
- taskflow/engines/action_engine/compiler.py +9 -11
- taskflow/engines/action_engine/completer.py +5 -7
- taskflow/engines/action_engine/deciders.py +1 -3
- taskflow/engines/action_engine/engine.py +4 -26
- taskflow/engines/action_engine/executor.py +2 -4
- taskflow/engines/action_engine/runtime.py +1 -3
- taskflow/engines/action_engine/scheduler.py +3 -5
- taskflow/engines/action_engine/scopes.py +3 -5
- taskflow/engines/action_engine/selector.py +1 -3
- taskflow/engines/action_engine/traversal.py +0 -2
- taskflow/engines/base.py +1 -3
- taskflow/engines/helpers.py +0 -2
- taskflow/engines/worker_based/dispatcher.py +2 -4
- taskflow/engines/worker_based/endpoint.py +1 -3
- taskflow/engines/worker_based/engine.py +1 -4
- taskflow/engines/worker_based/executor.py +0 -2
- taskflow/engines/worker_based/protocol.py +1 -3
- taskflow/engines/worker_based/proxy.py +2 -4
- taskflow/engines/worker_based/server.py +3 -5
- taskflow/engines/worker_based/types.py +6 -7
- taskflow/engines/worker_based/worker.py +4 -6
- taskflow/examples/99_bottles.py +0 -2
- taskflow/examples/alphabet_soup.py +0 -2
- taskflow/examples/build_a_car.py +1 -3
- taskflow/examples/buildsystem.py +1 -3
- taskflow/examples/calculate_in_parallel.py +1 -3
- taskflow/examples/calculate_linear.py +3 -5
- taskflow/examples/create_parallel_volume.py +2 -5
- taskflow/examples/delayed_return.py +1 -3
- taskflow/examples/distance_calculator.py +12 -24
- taskflow/examples/dump_memory_backend.py +1 -3
- taskflow/examples/echo_listener.py +0 -2
- taskflow/examples/example_utils.py +1 -3
- taskflow/examples/fake_billing.py +9 -11
- taskflow/examples/graph_flow.py +2 -4
- taskflow/examples/hello_world.py +2 -4
- taskflow/examples/jobboard_produce_consume_colors.py +3 -5
- taskflow/examples/parallel_table_multiply.py +1 -3
- taskflow/examples/persistence_example.py +1 -3
- taskflow/examples/pseudo_scoping.py +2 -4
- taskflow/examples/resume_from_backend.py +1 -3
- taskflow/examples/resume_many_flows/my_flows.py +0 -2
- taskflow/examples/resume_many_flows/resume_all.py +1 -3
- taskflow/examples/resume_many_flows/run_flow.py +2 -4
- taskflow/examples/resume_many_flows.py +0 -2
- taskflow/examples/resume_vm_boot.py +12 -15
- taskflow/examples/resume_volume_create.py +3 -5
- taskflow/examples/retry_flow.py +0 -2
- taskflow/examples/reverting_linear.py +1 -3
- taskflow/examples/run_by_iter.py +0 -2
- taskflow/examples/run_by_iter_enumerate.py +1 -3
- taskflow/examples/share_engine_thread.py +2 -4
- taskflow/examples/simple_linear.py +0 -2
- taskflow/examples/simple_linear_listening.py +1 -3
- taskflow/examples/simple_linear_pass.py +0 -2
- taskflow/examples/simple_map_reduce.py +0 -2
- taskflow/examples/switch_graph_flow.py +1 -3
- taskflow/examples/timing_listener.py +1 -3
- taskflow/examples/tox_conductor.py +3 -5
- taskflow/examples/wbe_event_sender.py +0 -2
- taskflow/examples/wbe_mandelbrot.py +0 -2
- taskflow/examples/wbe_simple_linear.py +0 -2
- taskflow/examples/wrapped_exception.py +0 -2
- taskflow/exceptions.py +7 -9
- taskflow/flow.py +1 -3
- taskflow/formatters.py +22 -8
- taskflow/jobs/backends/__init__.py +0 -2
- taskflow/jobs/backends/impl_redis.py +22 -18
- taskflow/jobs/backends/impl_zookeeper.py +7 -8
- taskflow/jobs/base.py +5 -7
- taskflow/listeners/base.py +1 -3
- taskflow/listeners/capturing.py +1 -3
- taskflow/listeners/claims.py +1 -3
- taskflow/listeners/logging.py +10 -6
- taskflow/listeners/printing.py +1 -3
- taskflow/listeners/timing.py +10 -13
- taskflow/logging.py +0 -2
- taskflow/patterns/graph_flow.py +2 -4
- taskflow/patterns/linear_flow.py +4 -9
- taskflow/patterns/unordered_flow.py +4 -9
- taskflow/persistence/backends/__init__.py +1 -3
- taskflow/persistence/backends/impl_dir.py +3 -6
- taskflow/persistence/backends/impl_memory.py +6 -9
- taskflow/persistence/backends/impl_sqlalchemy.py +4 -6
- taskflow/persistence/backends/impl_zookeeper.py +2 -4
- taskflow/persistence/backends/sqlalchemy/alembic/env.py +0 -2
- taskflow/persistence/backends/sqlalchemy/alembic/versions/00af93df9d77_add_unique_into_all_indexes.py +80 -0
- taskflow/persistence/backends/sqlalchemy/alembic/versions/14b227d79a87_add_intention_column.py +0 -2
- taskflow/persistence/backends/sqlalchemy/alembic/versions/1c783c0c2875_replace_exception_an.py +0 -2
- taskflow/persistence/backends/sqlalchemy/alembic/versions/1cea328f0f65_initial_logbook_deta.py +0 -2
- taskflow/persistence/backends/sqlalchemy/alembic/versions/2ad4984f2864_switch_postgres_to_json_native.py +0 -2
- taskflow/persistence/backends/sqlalchemy/alembic/versions/3162c0f3f8e4_add_revert_results_and_revert_failure_.py +0 -2
- taskflow/persistence/backends/sqlalchemy/alembic/versions/589dccdf2b6e_rename_taskdetails_to_atomdetails.py +0 -2
- taskflow/persistence/backends/sqlalchemy/alembic/versions/84d6e888850_add_task_detail_type.py +0 -2
- taskflow/persistence/backends/sqlalchemy/tables.py +0 -2
- taskflow/persistence/base.py +2 -4
- taskflow/persistence/models.py +19 -24
- taskflow/persistence/path_based.py +1 -3
- taskflow/retry.py +12 -18
- taskflow/states.py +0 -2
- taskflow/storage.py +9 -11
- taskflow/task.py +15 -18
- taskflow/test.py +5 -5
- taskflow/tests/test_examples.py +0 -2
- taskflow/tests/unit/action_engine/test_builder.py +1 -3
- taskflow/tests/unit/action_engine/test_compile.py +4 -6
- taskflow/tests/unit/action_engine/test_creation.py +0 -21
- taskflow/tests/unit/action_engine/test_scoping.py +1 -3
- taskflow/tests/unit/jobs/base.py +1 -3
- taskflow/tests/unit/jobs/test_entrypoint.py +0 -2
- taskflow/tests/unit/jobs/test_redis_job.py +1 -3
- taskflow/tests/unit/jobs/test_zk_job.py +2 -4
- taskflow/tests/unit/patterns/test_graph_flow.py +18 -20
- taskflow/tests/unit/patterns/test_linear_flow.py +7 -9
- taskflow/tests/unit/patterns/test_unordered_flow.py +12 -14
- taskflow/tests/unit/persistence/base.py +2 -4
- taskflow/tests/unit/persistence/test_dir_persistence.py +2 -4
- taskflow/tests/unit/persistence/test_memory_persistence.py +2 -4
- taskflow/tests/unit/persistence/test_sql_persistence.py +4 -6
- taskflow/tests/unit/persistence/test_zk_persistence.py +2 -4
- taskflow/tests/unit/test_arguments_passing.py +3 -25
- taskflow/tests/unit/test_check_transition.py +3 -5
- taskflow/tests/unit/test_conductors.py +0 -2
- taskflow/tests/unit/test_deciders.py +1 -3
- taskflow/tests/unit/test_engine_helpers.py +0 -2
- taskflow/tests/unit/test_engines.py +19 -102
- taskflow/tests/unit/test_exceptions.py +4 -6
- taskflow/tests/unit/test_failure.py +10 -12
- taskflow/tests/unit/test_flow_dependencies.py +62 -64
- taskflow/tests/unit/test_formatters.py +0 -2
- taskflow/tests/unit/test_functor_task.py +1 -3
- taskflow/tests/unit/test_listeners.py +9 -11
- taskflow/tests/unit/test_mapfunctor_task.py +1 -3
- taskflow/tests/unit/test_notifier.py +1 -3
- taskflow/tests/unit/test_progress.py +2 -4
- taskflow/tests/unit/test_reducefunctor_task.py +1 -3
- taskflow/tests/unit/test_retries.py +1 -25
- taskflow/tests/unit/test_states.py +0 -2
- taskflow/tests/unit/test_storage.py +10 -12
- taskflow/tests/unit/test_suspend.py +2 -23
- taskflow/tests/unit/test_task.py +17 -19
- taskflow/tests/unit/test_types.py +4 -6
- taskflow/tests/unit/test_utils.py +9 -11
- taskflow/tests/unit/test_utils_async_utils.py +0 -2
- taskflow/tests/unit/test_utils_binary.py +12 -14
- taskflow/tests/unit/test_utils_iter_utils.py +1 -3
- taskflow/tests/unit/test_utils_kazoo_utils.py +0 -2
- taskflow/tests/unit/test_utils_threading_utils.py +1 -3
- taskflow/tests/unit/worker_based/test_creation.py +0 -2
- taskflow/tests/unit/worker_based/test_dispatcher.py +0 -2
- taskflow/tests/unit/worker_based/test_endpoint.py +2 -4
- taskflow/tests/unit/worker_based/test_executor.py +1 -3
- taskflow/tests/unit/worker_based/test_message_pump.py +0 -2
- taskflow/tests/unit/worker_based/test_pipeline.py +0 -2
- taskflow/tests/unit/worker_based/test_protocol.py +2 -4
- taskflow/tests/unit/worker_based/test_proxy.py +2 -4
- taskflow/tests/unit/worker_based/test_server.py +3 -5
- taskflow/tests/unit/worker_based/test_types.py +0 -2
- taskflow/tests/unit/worker_based/test_worker.py +1 -3
- taskflow/tests/utils.py +11 -15
- taskflow/types/entity.py +1 -3
- taskflow/types/failure.py +3 -6
- taskflow/types/graph.py +14 -18
- taskflow/types/latch.py +1 -3
- taskflow/types/notifier.py +6 -9
- taskflow/types/sets.py +2 -5
- taskflow/types/timing.py +1 -3
- taskflow/types/tree.py +6 -10
- taskflow/utils/async_utils.py +0 -2
- taskflow/utils/banner.py +8 -9
- taskflow/utils/eventlet_utils.py +0 -2
- taskflow/utils/iter_utils.py +0 -2
- taskflow/utils/kazoo_utils.py +7 -9
- taskflow/utils/kombu_utils.py +5 -7
- taskflow/utils/misc.py +4 -6
- taskflow/utils/persistence_utils.py +0 -2
- taskflow/utils/redis_utils.py +2 -4
- taskflow/utils/schema_utils.py +0 -2
- taskflow/utils/threading_utils.py +1 -3
- taskflow/version.py +1 -3
- {taskflow-5.12.0.dist-info → taskflow-6.0.0.dist-info}/AUTHORS +1 -0
- {taskflow-5.12.0.dist-info → taskflow-6.0.0.dist-info}/METADATA +1 -1
- taskflow-6.0.0.dist-info/RECORD +243 -0
- {taskflow-5.12.0.dist-info → taskflow-6.0.0.dist-info}/WHEEL +1 -1
- taskflow-6.0.0.dist-info/pbr.json +1 -0
- taskflow/engines/action_engine/process_executor.py +0 -720
- taskflow/tests/unit/action_engine/test_process_executor.py +0 -106
- taskflow-5.12.0.dist-info/RECORD +0 -244
- taskflow-5.12.0.dist-info/pbr.json +0 -1
- {taskflow-5.12.0.dist-info → taskflow-6.0.0.dist-info}/LICENSE +0 -0
- {taskflow-5.12.0.dist-info → taskflow-6.0.0.dist-info}/entry_points.txt +0 -0
- {taskflow-5.12.0.dist-info → taskflow-6.0.0.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
# Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
|
|
4
2
|
#
|
|
5
3
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
@@ -76,8 +74,8 @@ class GraphFlowTest(test.TestCase):
|
|
|
76
74
|
self.assertEqual(1, len(f))
|
|
77
75
|
self.assertEqual([task], list(f))
|
|
78
76
|
self.assertEqual([], list(f.iter_links()))
|
|
79
|
-
self.assertEqual(
|
|
80
|
-
self.assertEqual(
|
|
77
|
+
self.assertEqual({'a', 'b'}, f.requires)
|
|
78
|
+
self.assertEqual({'c', 'd'}, f.provides)
|
|
81
79
|
|
|
82
80
|
def test_graph_flow_two_independent_tasks(self):
|
|
83
81
|
task1 = _task(name='task1')
|
|
@@ -95,11 +93,11 @@ class GraphFlowTest(test.TestCase):
|
|
|
95
93
|
|
|
96
94
|
self.assertEqual(2, len(f))
|
|
97
95
|
self.assertCountEqual(f, [task1, task2])
|
|
98
|
-
self.assertEqual([(task1, task2, {'reasons':
|
|
96
|
+
self.assertEqual([(task1, task2, {'reasons': {'a'}})],
|
|
99
97
|
list(f.iter_links()))
|
|
100
98
|
|
|
101
99
|
self.assertEqual(set(), f.requires)
|
|
102
|
-
self.assertEqual(
|
|
100
|
+
self.assertEqual({'a'}, f.provides)
|
|
103
101
|
|
|
104
102
|
def test_graph_flow_two_dependent_tasks_two_different_calls(self):
|
|
105
103
|
task1 = _task(name='task1', provides=['a'])
|
|
@@ -108,7 +106,7 @@ class GraphFlowTest(test.TestCase):
|
|
|
108
106
|
|
|
109
107
|
self.assertEqual(2, len(f))
|
|
110
108
|
self.assertCountEqual(f, [task1, task2])
|
|
111
|
-
self.assertEqual([(task1, task2, {'reasons':
|
|
109
|
+
self.assertEqual([(task1, task2, {'reasons': {'a'}})],
|
|
112
110
|
list(f.iter_links()))
|
|
113
111
|
|
|
114
112
|
def test_graph_flow_two_task_same_provide(self):
|
|
@@ -116,14 +114,14 @@ class GraphFlowTest(test.TestCase):
|
|
|
116
114
|
task2 = _task(name='task2', provides=['a', 'c'])
|
|
117
115
|
f = gf.Flow('test')
|
|
118
116
|
f.add(task2, task1)
|
|
119
|
-
self.assertEqual(
|
|
117
|
+
self.assertEqual({'a', 'b', 'c'}, f.provides)
|
|
120
118
|
|
|
121
119
|
def test_graph_flow_ambiguous_provides(self):
|
|
122
120
|
task1 = _task(name='task1', provides=['a', 'b'])
|
|
123
121
|
task2 = _task(name='task2', provides=['a'])
|
|
124
122
|
f = gf.Flow('test')
|
|
125
123
|
f.add(task1, task2)
|
|
126
|
-
self.assertEqual(
|
|
124
|
+
self.assertEqual({'a', 'b'}, f.provides)
|
|
127
125
|
task3 = _task(name='task3', requires=['a'])
|
|
128
126
|
self.assertRaises(exc.AmbiguousDependency, f.add, task3)
|
|
129
127
|
|
|
@@ -132,7 +130,7 @@ class GraphFlowTest(test.TestCase):
|
|
|
132
130
|
task2 = _task(name='task2', requires=['a', 'b'])
|
|
133
131
|
f = gf.Flow('test')
|
|
134
132
|
f.add(task1, task2, resolve_requires=False)
|
|
135
|
-
self.assertEqual(
|
|
133
|
+
self.assertEqual({'a', 'b'}, f.requires)
|
|
136
134
|
|
|
137
135
|
def test_graph_flow_no_resolve_existing(self):
|
|
138
136
|
task1 = _task(name='task1', requires=['a', 'b'])
|
|
@@ -140,7 +138,7 @@ class GraphFlowTest(test.TestCase):
|
|
|
140
138
|
f = gf.Flow('test')
|
|
141
139
|
f.add(task1)
|
|
142
140
|
f.add(task2, resolve_existing=False)
|
|
143
|
-
self.assertEqual(
|
|
141
|
+
self.assertEqual({'a', 'b'}, f.requires)
|
|
144
142
|
|
|
145
143
|
def test_graph_flow_resolve_existing(self):
|
|
146
144
|
task1 = _task(name='task1', requires=['a', 'b'])
|
|
@@ -148,7 +146,7 @@ class GraphFlowTest(test.TestCase):
|
|
|
148
146
|
f = gf.Flow('test')
|
|
149
147
|
f.add(task1)
|
|
150
148
|
f.add(task2, resolve_existing=True)
|
|
151
|
-
self.assertEqual(set(
|
|
149
|
+
self.assertEqual(set(), f.requires)
|
|
152
150
|
|
|
153
151
|
def test_graph_flow_with_retry(self):
|
|
154
152
|
ret = retry.AlwaysRevert(requires=['a'], provides=['b'])
|
|
@@ -156,11 +154,11 @@ class GraphFlowTest(test.TestCase):
|
|
|
156
154
|
self.assertIs(f.retry, ret)
|
|
157
155
|
self.assertEqual('test_retry', ret.name)
|
|
158
156
|
|
|
159
|
-
self.assertEqual(
|
|
160
|
-
self.assertEqual(
|
|
157
|
+
self.assertEqual({'a'}, f.requires)
|
|
158
|
+
self.assertEqual({'b'}, f.provides)
|
|
161
159
|
|
|
162
160
|
def test_graph_flow_ordering(self):
|
|
163
|
-
task1 = _task('task1', provides=
|
|
161
|
+
task1 = _task('task1', provides={'a', 'b'})
|
|
164
162
|
task2 = _task('task2', provides=['c'], requires=['a', 'b'])
|
|
165
163
|
task3 = _task('task3', provides=[], requires=['c'])
|
|
166
164
|
f = gf.Flow('test').add(task1, task2, task3)
|
|
@@ -168,8 +166,8 @@ class GraphFlowTest(test.TestCase):
|
|
|
168
166
|
self.assertEqual(3, len(f))
|
|
169
167
|
|
|
170
168
|
self.assertCountEqual(list(f.iter_links()), [
|
|
171
|
-
(task1, task2, {'reasons':
|
|
172
|
-
(task2, task3, {'reasons':
|
|
169
|
+
(task1, task2, {'reasons': {'a', 'b'}}),
|
|
170
|
+
(task2, task3, {'reasons': {'c'}})
|
|
173
171
|
])
|
|
174
172
|
|
|
175
173
|
def test_graph_flow_links(self):
|
|
@@ -190,7 +188,7 @@ class GraphFlowTest(test.TestCase):
|
|
|
190
188
|
self.assertIs(linked, f)
|
|
191
189
|
expected_meta = {
|
|
192
190
|
'manual': True,
|
|
193
|
-
'reasons':
|
|
191
|
+
'reasons': {'a'}
|
|
194
192
|
}
|
|
195
193
|
self.assertCountEqual(list(f.iter_links()), [
|
|
196
194
|
(task1, task2, expected_meta)
|
|
@@ -236,7 +234,7 @@ class GraphFlowTest(test.TestCase):
|
|
|
236
234
|
task3 = _task('task3', provides=['c'])
|
|
237
235
|
f1 = gf.Flow('nested')
|
|
238
236
|
f1.add(task3)
|
|
239
|
-
tasks =
|
|
237
|
+
tasks = {task1, task2, f1}
|
|
240
238
|
f = gf.Flow('test').add(task1, task2, f1)
|
|
241
239
|
for (n, data) in f.iter_nodes():
|
|
242
240
|
self.assertIn(n, tasks)
|
|
@@ -248,7 +246,7 @@ class GraphFlowTest(test.TestCase):
|
|
|
248
246
|
task3 = _task('task3')
|
|
249
247
|
f1 = gf.Flow('nested')
|
|
250
248
|
f1.add(task3)
|
|
251
|
-
tasks =
|
|
249
|
+
tasks = {task1, task2, f1}
|
|
252
250
|
f = gf.Flow('test').add(task1, task2, f1)
|
|
253
251
|
for (u, v, data) in f.iter_links():
|
|
254
252
|
self.assertIn(u, tasks)
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
# Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
|
|
4
2
|
#
|
|
5
3
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
@@ -65,8 +63,8 @@ class LinearFlowTest(test.TestCase):
|
|
|
65
63
|
self.assertEqual(1, len(f))
|
|
66
64
|
self.assertEqual([task], list(f))
|
|
67
65
|
self.assertEqual([], list(f.iter_links()))
|
|
68
|
-
self.assertEqual(
|
|
69
|
-
self.assertEqual(
|
|
66
|
+
self.assertEqual({'a', 'b'}, f.requires)
|
|
67
|
+
self.assertEqual({'c', 'd'}, f.provides)
|
|
70
68
|
|
|
71
69
|
def test_linear_flow_two_independent_tasks(self):
|
|
72
70
|
task1 = _task(name='task1')
|
|
@@ -89,7 +87,7 @@ class LinearFlowTest(test.TestCase):
|
|
|
89
87
|
list(f.iter_links()))
|
|
90
88
|
|
|
91
89
|
self.assertEqual(set(), f.requires)
|
|
92
|
-
self.assertEqual(
|
|
90
|
+
self.assertEqual({'a'}, f.provides)
|
|
93
91
|
|
|
94
92
|
def test_linear_flow_two_dependent_tasks_two_different_calls(self):
|
|
95
93
|
task1 = _task(name='task1', provides=['a'])
|
|
@@ -120,15 +118,15 @@ class LinearFlowTest(test.TestCase):
|
|
|
120
118
|
self.assertIs(f.retry, ret)
|
|
121
119
|
self.assertEqual('test_retry', ret.name)
|
|
122
120
|
|
|
123
|
-
self.assertEqual(
|
|
124
|
-
self.assertEqual(
|
|
121
|
+
self.assertEqual({'a'}, f.requires)
|
|
122
|
+
self.assertEqual({'b'}, f.provides)
|
|
125
123
|
|
|
126
124
|
def test_iter_nodes(self):
|
|
127
125
|
task1 = _task(name='task1')
|
|
128
126
|
task2 = _task(name='task2')
|
|
129
127
|
task3 = _task(name='task3')
|
|
130
128
|
f = lf.Flow('test').add(task1, task2, task3)
|
|
131
|
-
tasks =
|
|
129
|
+
tasks = {task1, task2, task3}
|
|
132
130
|
for (node, data) in f.iter_nodes():
|
|
133
131
|
self.assertIn(node, tasks)
|
|
134
132
|
self.assertDictEqual({}, data)
|
|
@@ -138,7 +136,7 @@ class LinearFlowTest(test.TestCase):
|
|
|
138
136
|
task2 = _task(name='task2')
|
|
139
137
|
task3 = _task(name='task3')
|
|
140
138
|
f = lf.Flow('test').add(task1, task2, task3)
|
|
141
|
-
tasks =
|
|
139
|
+
tasks = {task1, task2, task3}
|
|
142
140
|
for (u, v, data) in f.iter_links():
|
|
143
141
|
self.assertIn(u, tasks)
|
|
144
142
|
self.assertIn(v, tasks)
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
# Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
|
|
4
2
|
#
|
|
5
3
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
@@ -65,8 +63,8 @@ class UnorderedFlowTest(test.TestCase):
|
|
|
65
63
|
self.assertEqual(1, len(f))
|
|
66
64
|
self.assertEqual([task], list(f))
|
|
67
65
|
self.assertEqual([], list(f.iter_links()))
|
|
68
|
-
self.assertEqual(
|
|
69
|
-
self.assertEqual(
|
|
66
|
+
self.assertEqual({'a', 'b'}, f.requires)
|
|
67
|
+
self.assertEqual({'c', 'd'}, f.provides)
|
|
70
68
|
|
|
71
69
|
def test_unordered_flow_two_tasks(self):
|
|
72
70
|
task1 = _task(name='task1')
|
|
@@ -74,7 +72,7 @@ class UnorderedFlowTest(test.TestCase):
|
|
|
74
72
|
f = uf.Flow('test').add(task1, task2)
|
|
75
73
|
|
|
76
74
|
self.assertEqual(2, len(f))
|
|
77
|
-
self.assertEqual(
|
|
75
|
+
self.assertEqual({task1, task2}, set(f))
|
|
78
76
|
self.assertEqual([], list(f.iter_links()))
|
|
79
77
|
|
|
80
78
|
def test_unordered_flow_two_tasks_two_different_calls(self):
|
|
@@ -83,16 +81,16 @@ class UnorderedFlowTest(test.TestCase):
|
|
|
83
81
|
f = uf.Flow('test').add(task1)
|
|
84
82
|
f.add(task2)
|
|
85
83
|
self.assertEqual(2, len(f))
|
|
86
|
-
self.assertEqual(
|
|
87
|
-
self.assertEqual(
|
|
84
|
+
self.assertEqual({'a'}, f.requires)
|
|
85
|
+
self.assertEqual({'a'}, f.provides)
|
|
88
86
|
|
|
89
87
|
def test_unordered_flow_two_tasks_reverse_order(self):
|
|
90
88
|
task1 = _task(name='task1', provides=['a'])
|
|
91
89
|
task2 = _task(name='task2', requires=['a'])
|
|
92
90
|
f = uf.Flow('test').add(task2).add(task1)
|
|
93
91
|
self.assertEqual(2, len(f))
|
|
94
|
-
self.assertEqual(
|
|
95
|
-
self.assertEqual(
|
|
92
|
+
self.assertEqual({'a'}, f.requires)
|
|
93
|
+
self.assertEqual({'a'}, f.provides)
|
|
96
94
|
|
|
97
95
|
def test_unordered_flow_two_task_same_provide(self):
|
|
98
96
|
task1 = _task(name='task1', provides=['a', 'b'])
|
|
@@ -107,8 +105,8 @@ class UnorderedFlowTest(test.TestCase):
|
|
|
107
105
|
self.assertIs(f.retry, ret)
|
|
108
106
|
self.assertEqual('test_retry', ret.name)
|
|
109
107
|
|
|
110
|
-
self.assertEqual(
|
|
111
|
-
self.assertEqual(
|
|
108
|
+
self.assertEqual({'a'}, f.requires)
|
|
109
|
+
self.assertEqual({'b'}, f.provides)
|
|
112
110
|
|
|
113
111
|
def test_unordered_flow_with_retry_fully_satisfies(self):
|
|
114
112
|
ret = retry.AlwaysRevert(provides=['b', 'a'])
|
|
@@ -116,13 +114,13 @@ class UnorderedFlowTest(test.TestCase):
|
|
|
116
114
|
f.add(_task(name='task1', requires=['a']))
|
|
117
115
|
self.assertIs(f.retry, ret)
|
|
118
116
|
self.assertEqual('test_retry', ret.name)
|
|
119
|
-
self.assertEqual(set(
|
|
120
|
-
self.assertEqual(
|
|
117
|
+
self.assertEqual(set(), f.requires)
|
|
118
|
+
self.assertEqual({'b', 'a'}, f.provides)
|
|
121
119
|
|
|
122
120
|
def test_iter_nodes(self):
|
|
123
121
|
task1 = _task(name='task1', provides=['a', 'b'])
|
|
124
122
|
task2 = _task(name='task2', provides=['a', 'c'])
|
|
125
|
-
tasks =
|
|
123
|
+
tasks = {task1, task2}
|
|
126
124
|
f = uf.Flow('test')
|
|
127
125
|
f.add(task2, task1)
|
|
128
126
|
for (node, data) in f.iter_nodes():
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
# Copyright (C) 2013 Rackspace Hosting All Rights Reserved.
|
|
4
2
|
#
|
|
5
3
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
@@ -24,7 +22,7 @@ from taskflow import states
|
|
|
24
22
|
from taskflow.types import failure
|
|
25
23
|
|
|
26
24
|
|
|
27
|
-
class PersistenceTestMixin
|
|
25
|
+
class PersistenceTestMixin:
|
|
28
26
|
def _get_connection(self):
|
|
29
27
|
raise NotImplementedError('_get_connection() implementation required')
|
|
30
28
|
|
|
@@ -73,7 +71,7 @@ class PersistenceTestMixin(object):
|
|
|
73
71
|
lb_ids = {}
|
|
74
72
|
for i in range(0, 10):
|
|
75
73
|
lb_id = uuidutils.generate_uuid()
|
|
76
|
-
lb_name = 'lb
|
|
74
|
+
lb_name = 'lb-{}-{}'.format(i, lb_id)
|
|
77
75
|
lb = models.LogBook(name=lb_name, uuid=lb_id)
|
|
78
76
|
lb_ids[lb_id] = True
|
|
79
77
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
# Copyright (C) 2013 Rackspace Hosting All Rights Reserved.
|
|
4
2
|
#
|
|
5
3
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
@@ -45,7 +43,7 @@ class DirPersistenceTest(testscenarios.TestWithScenarios,
|
|
|
45
43
|
return self.backend.get_connection()
|
|
46
44
|
|
|
47
45
|
def setUp(self):
|
|
48
|
-
super(
|
|
46
|
+
super().setUp()
|
|
49
47
|
self.path = tempfile.mkdtemp()
|
|
50
48
|
self.backend = impl_dir.DirBackend({
|
|
51
49
|
'path': self.path,
|
|
@@ -55,7 +53,7 @@ class DirPersistenceTest(testscenarios.TestWithScenarios,
|
|
|
55
53
|
conn.upgrade()
|
|
56
54
|
|
|
57
55
|
def tearDown(self):
|
|
58
|
-
super(
|
|
56
|
+
super().tearDown()
|
|
59
57
|
if self.path and os.path.isdir(self.path):
|
|
60
58
|
shutil.rmtree(self.path)
|
|
61
59
|
self.path = None
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
# Copyright (C) 2013 Rackspace Hosting All Rights Reserved.
|
|
4
2
|
#
|
|
5
3
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
@@ -25,7 +23,7 @@ from taskflow.tests.unit.persistence import base
|
|
|
25
23
|
|
|
26
24
|
class MemoryPersistenceTest(test.TestCase, base.PersistenceTestMixin):
|
|
27
25
|
def setUp(self):
|
|
28
|
-
super(
|
|
26
|
+
super().setUp()
|
|
29
27
|
self._backend = impl_memory.MemoryBackend({})
|
|
30
28
|
|
|
31
29
|
def _get_connection(self):
|
|
@@ -35,7 +33,7 @@ class MemoryPersistenceTest(test.TestCase, base.PersistenceTestMixin):
|
|
|
35
33
|
conn = self._get_connection()
|
|
36
34
|
conn.clear_all()
|
|
37
35
|
self._backend = None
|
|
38
|
-
super(
|
|
36
|
+
super().tearDown()
|
|
39
37
|
|
|
40
38
|
def test_memory_backend_entry_point(self):
|
|
41
39
|
conf = {'connection': 'memory:'}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
# Copyright (C) 2013 Rackspace Hosting All Rights Reserved.
|
|
4
2
|
#
|
|
5
3
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
@@ -61,7 +59,7 @@ def _get_connect_string(backend, user, passwd, database=None, variant=None):
|
|
|
61
59
|
raise Exception("Unrecognized backend: '%s'" % backend)
|
|
62
60
|
if not database:
|
|
63
61
|
database = ''
|
|
64
|
-
return "
|
|
62
|
+
return "{}://{}:{}@localhost/{}".format(backend, user, passwd, database)
|
|
65
63
|
|
|
66
64
|
|
|
67
65
|
def _mysql_exists():
|
|
@@ -108,7 +106,7 @@ class SqlitePersistenceTest(test.TestCase, base.PersistenceTestMixin):
|
|
|
108
106
|
return impl_sqlalchemy.SQLAlchemyBackend(conf).get_connection()
|
|
109
107
|
|
|
110
108
|
def setUp(self):
|
|
111
|
-
super(
|
|
109
|
+
super().setUp()
|
|
112
110
|
self.db_location = tempfile.mktemp(suffix='.db')
|
|
113
111
|
self.db_uri = "sqlite:///%s" % (self.db_location)
|
|
114
112
|
# Ensure upgraded to the right schema
|
|
@@ -116,7 +114,7 @@ class SqlitePersistenceTest(test.TestCase, base.PersistenceTestMixin):
|
|
|
116
114
|
conn.upgrade()
|
|
117
115
|
|
|
118
116
|
def tearDown(self):
|
|
119
|
-
super(
|
|
117
|
+
super().tearDown()
|
|
120
118
|
if self.db_location and os.path.isfile(self.db_location):
|
|
121
119
|
os.unlink(self.db_location)
|
|
122
120
|
self.db_location = None
|
|
@@ -146,7 +144,7 @@ class BackendPersistenceTestMixin(base.PersistenceTestMixin,
|
|
|
146
144
|
"""Cleans up by removing the database once the tests are done."""
|
|
147
145
|
|
|
148
146
|
def setUp(self):
|
|
149
|
-
super(
|
|
147
|
+
super().setUp()
|
|
150
148
|
self.backend = None
|
|
151
149
|
try:
|
|
152
150
|
self.db_uri = self._init_db()
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
# Copyright (C) 2014 AT&T Labs All Rights Reserved.
|
|
4
2
|
#
|
|
5
3
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
@@ -56,7 +54,7 @@ class ZkPersistenceTest(test.TestCase, base.PersistenceTestMixin):
|
|
|
56
54
|
return self.backend.get_connection()
|
|
57
55
|
|
|
58
56
|
def setUp(self):
|
|
59
|
-
super(
|
|
57
|
+
super().setUp()
|
|
60
58
|
conf = test_utils.ZK_TEST_CONFIG.copy()
|
|
61
59
|
# Create a unique path just for this test (so that we don't overwrite
|
|
62
60
|
# what other tests are doing).
|
|
@@ -84,7 +82,7 @@ class ZakePersistenceTest(test.TestCase, base.PersistenceTestMixin):
|
|
|
84
82
|
return self._backend.get_connection()
|
|
85
83
|
|
|
86
84
|
def setUp(self):
|
|
87
|
-
super(
|
|
85
|
+
super().setUp()
|
|
88
86
|
conf = {
|
|
89
87
|
"path": "/taskflow",
|
|
90
88
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
|
|
4
2
|
#
|
|
5
3
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
@@ -23,11 +21,6 @@ from taskflow import test
|
|
|
23
21
|
from taskflow.tests import utils
|
|
24
22
|
from taskflow.utils import eventlet_utils as eu
|
|
25
23
|
|
|
26
|
-
try:
|
|
27
|
-
from taskflow.engines.action_engine import process_executor as pe
|
|
28
|
-
except ImportError:
|
|
29
|
-
pe = None
|
|
30
|
-
|
|
31
24
|
|
|
32
25
|
class ArgumentsPassingTest(utils.EngineTestBase):
|
|
33
26
|
|
|
@@ -55,9 +48,9 @@ class ArgumentsPassingTest(utils.EngineTestBase):
|
|
|
55
48
|
}, engine.storage.fetch_all())
|
|
56
49
|
|
|
57
50
|
def test_save_dict(self):
|
|
58
|
-
flow = utils.TaskMultiDict(provides=
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
flow = utils.TaskMultiDict(provides={'badger',
|
|
52
|
+
'mushroom',
|
|
53
|
+
'snake'})
|
|
61
54
|
engine = self._make_engine(flow)
|
|
62
55
|
engine.run()
|
|
63
56
|
self.assertEqual({
|
|
@@ -224,18 +217,3 @@ class ParallelEngineWithEventletTest(ArgumentsPassingTest, test.TestCase):
|
|
|
224
217
|
backend=self.backend,
|
|
225
218
|
engine='parallel',
|
|
226
219
|
executor=executor)
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
@testtools.skipIf(pe is None, 'process_executor is not available')
|
|
230
|
-
class ParallelEngineWithProcessTest(ArgumentsPassingTest, test.TestCase):
|
|
231
|
-
_EXECUTOR_WORKERS = 2
|
|
232
|
-
|
|
233
|
-
def _make_engine(self, flow, flow_detail=None, executor=None):
|
|
234
|
-
if executor is None:
|
|
235
|
-
executor = 'processes'
|
|
236
|
-
return taskflow.engines.load(flow,
|
|
237
|
-
flow_detail=flow_detail,
|
|
238
|
-
backend=self.backend,
|
|
239
|
-
engine='parallel',
|
|
240
|
-
executor=executor,
|
|
241
|
-
max_workers=self._EXECUTOR_WORKERS)
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
# Copyright (C) 2013 Yahoo! Inc. All Rights Reserved.
|
|
4
2
|
#
|
|
5
3
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
@@ -50,7 +48,7 @@ class TransitionTest(test.TestCase):
|
|
|
50
48
|
class CheckFlowTransitionTest(TransitionTest):
|
|
51
49
|
|
|
52
50
|
def setUp(self):
|
|
53
|
-
super(
|
|
51
|
+
super().setUp()
|
|
54
52
|
self.check_transition = states.check_flow_transition
|
|
55
53
|
self.transition_exc_regexp = '^Flow transition.*not allowed'
|
|
56
54
|
|
|
@@ -73,7 +71,7 @@ class CheckFlowTransitionTest(TransitionTest):
|
|
|
73
71
|
class CheckTaskTransitionTest(TransitionTest):
|
|
74
72
|
|
|
75
73
|
def setUp(self):
|
|
76
|
-
super(
|
|
74
|
+
super().setUp()
|
|
77
75
|
self.check_transition = states.check_task_transition
|
|
78
76
|
self.transition_exc_regexp = '^Task transition.*not allowed'
|
|
79
77
|
|
|
@@ -122,7 +120,7 @@ class CheckTaskTransitionTest(TransitionTest):
|
|
|
122
120
|
class CheckRetryTransitionTest(CheckTaskTransitionTest):
|
|
123
121
|
|
|
124
122
|
def setUp(self):
|
|
125
|
-
super(
|
|
123
|
+
super().setUp()
|
|
126
124
|
self.check_transition = states.check_retry_transition
|
|
127
125
|
self.transition_exc_regexp = '^Retry transition.*not allowed'
|
|
128
126
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
# Copyright (C) 2015 Yahoo! Inc. All Rights Reserved.
|
|
4
2
|
#
|
|
5
3
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
@@ -55,4 +53,4 @@ class TestDeciders(test.TestCase):
|
|
|
55
53
|
def test_bad_pick_widest(self):
|
|
56
54
|
self.assertRaises(ValueError, deciders.pick_widest, [])
|
|
57
55
|
self.assertRaises(ValueError, deciders.pick_widest, ["a"])
|
|
58
|
-
self.assertRaises(ValueError, deciders.pick_widest,
|
|
56
|
+
self.assertRaises(ValueError, deciders.pick_widest, {'b'})
|