taskflow 5.11.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 +2 -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.11.0.dist-info → taskflow-6.0.0.dist-info}/AUTHORS +1 -0
- {taskflow-5.11.0.dist-info → taskflow-6.0.0.dist-info}/METADATA +2 -1
- taskflow-6.0.0.dist-info/RECORD +243 -0
- {taskflow-5.11.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.11.0.dist-info/RECORD +0 -244
- taskflow-5.11.0.dist-info/pbr.json +0 -1
- {taskflow-5.11.0.dist-info → taskflow-6.0.0.dist-info}/LICENSE +0 -0
- {taskflow-5.11.0.dist-info → taskflow-6.0.0.dist-info}/entry_points.txt +0 -0
- {taskflow-5.11.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) 2012 Yahoo! Inc. All Rights Reserved.
|
|
4
2
|
#
|
|
5
3
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
@@ -41,11 +39,6 @@ from taskflow.utils import eventlet_utils as eu
|
|
|
41
39
|
from taskflow.utils import persistence_utils as p_utils
|
|
42
40
|
from taskflow.utils import threading_utils as tu
|
|
43
41
|
|
|
44
|
-
try:
|
|
45
|
-
from taskflow.engines.action_engine import process_executor as pe
|
|
46
|
-
except ImportError:
|
|
47
|
-
pe = None
|
|
48
|
-
|
|
49
42
|
|
|
50
43
|
# Expected engine transitions when empty workflows are ran...
|
|
51
44
|
_EMPTY_TRANSITIONS = [
|
|
@@ -54,7 +47,7 @@ _EMPTY_TRANSITIONS = [
|
|
|
54
47
|
]
|
|
55
48
|
|
|
56
49
|
|
|
57
|
-
class EngineTaskNotificationsTest
|
|
50
|
+
class EngineTaskNotificationsTest:
|
|
58
51
|
def test_run_capture_task_notifications(self):
|
|
59
52
|
captured = collections.defaultdict(list)
|
|
60
53
|
|
|
@@ -89,7 +82,7 @@ class EngineTaskNotificationsTest(object):
|
|
|
89
82
|
self.assertEqual(expected, captured[name])
|
|
90
83
|
|
|
91
84
|
|
|
92
|
-
class EngineTaskTest
|
|
85
|
+
class EngineTaskTest:
|
|
93
86
|
|
|
94
87
|
def test_run_task_as_flow(self):
|
|
95
88
|
flow = utils.ProgressingTask(name='task1')
|
|
@@ -583,8 +576,8 @@ class EngineParallelFlowTest(utils.EngineTestBase):
|
|
|
583
576
|
engine = self._make_engine(flow)
|
|
584
577
|
with utils.CaptureListener(engine, capture_flow=False) as capturer:
|
|
585
578
|
engine.run()
|
|
586
|
-
expected =
|
|
587
|
-
|
|
579
|
+
expected = {'task2.t SUCCESS(5)', 'task2.t RUNNING',
|
|
580
|
+
'task1.t RUNNING', 'task1.t SUCCESS(5)'}
|
|
588
581
|
self.assertEqual(expected, set(capturer.values))
|
|
589
582
|
|
|
590
583
|
def test_parallel_revert(self):
|
|
@@ -858,8 +851,8 @@ class EngineGraphFlowTest(utils.EngineTestBase):
|
|
|
858
851
|
engine = self._make_engine(flow)
|
|
859
852
|
with utils.CaptureListener(engine, capture_flow=False) as capturer:
|
|
860
853
|
engine.run()
|
|
861
|
-
expected =
|
|
862
|
-
|
|
854
|
+
expected = {'task2.t SUCCESS(5)', 'task2.t RUNNING',
|
|
855
|
+
'task1.t RUNNING', 'task1.t SUCCESS(5)'}
|
|
863
856
|
self.assertEqual(expected, set(capturer.values))
|
|
864
857
|
self.assertEqual(2, len(flow))
|
|
865
858
|
|
|
@@ -1223,7 +1216,7 @@ class EngineGraphConditionalFlowTest(utils.EngineTestBase):
|
|
|
1223
1216
|
with utils.CaptureListener(engine, capture_flow=False) as capturer:
|
|
1224
1217
|
engine.run()
|
|
1225
1218
|
|
|
1226
|
-
expected =
|
|
1219
|
+
expected = {
|
|
1227
1220
|
'task1.t RUNNING',
|
|
1228
1221
|
'task1.t SUCCESS(5)',
|
|
1229
1222
|
|
|
@@ -1232,7 +1225,7 @@ class EngineGraphConditionalFlowTest(utils.EngineTestBase):
|
|
|
1232
1225
|
|
|
1233
1226
|
'task3.t RUNNING',
|
|
1234
1227
|
'task3.t SUCCESS(5)',
|
|
1235
|
-
|
|
1228
|
+
}
|
|
1236
1229
|
self.assertEqual(expected, set(capturer.values))
|
|
1237
1230
|
|
|
1238
1231
|
def test_graph_flow_conditional_ignore_reset(self):
|
|
@@ -1251,7 +1244,7 @@ class EngineGraphConditionalFlowTest(utils.EngineTestBase):
|
|
|
1251
1244
|
with utils.CaptureListener(engine, capture_flow=False) as capturer:
|
|
1252
1245
|
engine.run()
|
|
1253
1246
|
|
|
1254
|
-
expected =
|
|
1247
|
+
expected = {
|
|
1255
1248
|
'task1.t RUNNING',
|
|
1256
1249
|
'task1.t SUCCESS(5)',
|
|
1257
1250
|
|
|
@@ -1259,7 +1252,7 @@ class EngineGraphConditionalFlowTest(utils.EngineTestBase):
|
|
|
1259
1252
|
'task2.t SUCCESS(5)',
|
|
1260
1253
|
|
|
1261
1254
|
'task3.t IGNORE',
|
|
1262
|
-
|
|
1255
|
+
}
|
|
1263
1256
|
self.assertEqual(expected, set(capturer.values))
|
|
1264
1257
|
self.assertEqual(states.IGNORE,
|
|
1265
1258
|
engine.storage.get_atom_state('task3'))
|
|
@@ -1271,7 +1264,7 @@ class EngineGraphConditionalFlowTest(utils.EngineTestBase):
|
|
|
1271
1264
|
with utils.CaptureListener(engine, capture_flow=False) as capturer:
|
|
1272
1265
|
engine.run()
|
|
1273
1266
|
|
|
1274
|
-
expected =
|
|
1267
|
+
expected = {
|
|
1275
1268
|
'task1.t RUNNING',
|
|
1276
1269
|
'task1.t SUCCESS(5)',
|
|
1277
1270
|
|
|
@@ -1280,7 +1273,7 @@ class EngineGraphConditionalFlowTest(utils.EngineTestBase):
|
|
|
1280
1273
|
|
|
1281
1274
|
'task3.t RUNNING',
|
|
1282
1275
|
'task3.t SUCCESS(5)',
|
|
1283
|
-
|
|
1276
|
+
}
|
|
1284
1277
|
self.assertEqual(expected, set(capturer.values))
|
|
1285
1278
|
|
|
1286
1279
|
def test_graph_flow_diamond_ignored(self):
|
|
@@ -1301,7 +1294,7 @@ class EngineGraphConditionalFlowTest(utils.EngineTestBase):
|
|
|
1301
1294
|
with utils.CaptureListener(engine, capture_flow=False) as capturer:
|
|
1302
1295
|
engine.run()
|
|
1303
1296
|
|
|
1304
|
-
expected =
|
|
1297
|
+
expected = {
|
|
1305
1298
|
'task1.t RUNNING',
|
|
1306
1299
|
'task1.t SUCCESS(5)',
|
|
1307
1300
|
|
|
@@ -1312,7 +1305,7 @@ class EngineGraphConditionalFlowTest(utils.EngineTestBase):
|
|
|
1312
1305
|
'task3.t SUCCESS(5)',
|
|
1313
1306
|
|
|
1314
1307
|
'task4.t IGNORE',
|
|
1315
|
-
|
|
1308
|
+
}
|
|
1316
1309
|
self.assertEqual(expected, set(capturer.values))
|
|
1317
1310
|
self.assertEqual(states.IGNORE,
|
|
1318
1311
|
engine.storage.get_atom_state('task4'))
|
|
@@ -1350,12 +1343,12 @@ class EngineGraphConditionalFlowTest(utils.EngineTestBase):
|
|
|
1350
1343
|
with utils.CaptureListener(engine, capture_flow=False) as capturer:
|
|
1351
1344
|
engine.run()
|
|
1352
1345
|
|
|
1353
|
-
expected =
|
|
1346
|
+
expected = {
|
|
1354
1347
|
'task1.t RUNNING', 'task1.t SUCCESS(2)',
|
|
1355
1348
|
'task3.t IGNORE', 'task3_3.t IGNORE',
|
|
1356
1349
|
'task2.t RUNNING', 'task2.t SUCCESS(5)',
|
|
1357
1350
|
'task2_2.t RUNNING', 'task2_2.t SUCCESS(5)',
|
|
1358
|
-
|
|
1351
|
+
}
|
|
1359
1352
|
self.assertEqual(expected, set(capturer.values))
|
|
1360
1353
|
|
|
1361
1354
|
engine = self._make_engine(flow)
|
|
@@ -1363,12 +1356,12 @@ class EngineGraphConditionalFlowTest(utils.EngineTestBase):
|
|
|
1363
1356
|
with utils.CaptureListener(engine, capture_flow=False) as capturer:
|
|
1364
1357
|
engine.run()
|
|
1365
1358
|
|
|
1366
|
-
expected =
|
|
1359
|
+
expected = {
|
|
1367
1360
|
'task1.t RUNNING', 'task1.t SUCCESS(1)',
|
|
1368
1361
|
'task2.t IGNORE', 'task2_2.t IGNORE',
|
|
1369
1362
|
'task3.t RUNNING', 'task3.t SUCCESS(5)',
|
|
1370
1363
|
'task3_3.t RUNNING', 'task3_3.t SUCCESS(5)',
|
|
1371
|
-
|
|
1364
|
+
}
|
|
1372
1365
|
self.assertEqual(expected, set(capturer.values))
|
|
1373
1366
|
|
|
1374
1367
|
|
|
@@ -1499,82 +1492,6 @@ class ParallelEngineWithEventletTest(EngineTaskTest,
|
|
|
1499
1492
|
store=store, **kwargs)
|
|
1500
1493
|
|
|
1501
1494
|
|
|
1502
|
-
@testtools.skipIf(pe is None, 'process_executor is not available')
|
|
1503
|
-
class ParallelEngineWithProcessTest(EngineTaskTest,
|
|
1504
|
-
EngineMultipleResultsTest,
|
|
1505
|
-
EngineLinearFlowTest,
|
|
1506
|
-
EngineParallelFlowTest,
|
|
1507
|
-
EngineLinearAndUnorderedExceptionsTest,
|
|
1508
|
-
EngineOptionalRequirementsTest,
|
|
1509
|
-
EngineGraphFlowTest,
|
|
1510
|
-
EngineResetTests,
|
|
1511
|
-
EngineMissingDepsTest,
|
|
1512
|
-
EngineGraphConditionalFlowTest,
|
|
1513
|
-
EngineDeciderDepthTest,
|
|
1514
|
-
EngineTaskNotificationsTest,
|
|
1515
|
-
test.TestCase):
|
|
1516
|
-
_EXECUTOR_WORKERS = 2
|
|
1517
|
-
|
|
1518
|
-
def test_correct_load(self):
|
|
1519
|
-
engine = self._make_engine(utils.TaskNoRequiresNoReturns)
|
|
1520
|
-
self.assertIsInstance(engine, eng.ParallelActionEngine)
|
|
1521
|
-
|
|
1522
|
-
def _make_engine(self, flow,
|
|
1523
|
-
flow_detail=None, executor=None, store=None,
|
|
1524
|
-
**kwargs):
|
|
1525
|
-
if executor is None:
|
|
1526
|
-
executor = 'processes'
|
|
1527
|
-
return taskflow.engines.load(flow, flow_detail=flow_detail,
|
|
1528
|
-
backend=self.backend,
|
|
1529
|
-
engine='parallel',
|
|
1530
|
-
executor=executor,
|
|
1531
|
-
store=store,
|
|
1532
|
-
max_workers=self._EXECUTOR_WORKERS,
|
|
1533
|
-
**kwargs)
|
|
1534
|
-
|
|
1535
|
-
def test_update_progress_notifications_proxied(self):
|
|
1536
|
-
captured = collections.defaultdict(list)
|
|
1537
|
-
|
|
1538
|
-
def notify_me(event_type, details):
|
|
1539
|
-
captured[event_type].append(details)
|
|
1540
|
-
|
|
1541
|
-
a = utils.MultiProgressingTask('a')
|
|
1542
|
-
a.notifier.register(a.notifier.ANY, notify_me)
|
|
1543
|
-
progress_chunks = list(x / 10.0 for x in range(1, 10))
|
|
1544
|
-
e = self._make_engine(a, store={'progress_chunks': progress_chunks})
|
|
1545
|
-
e.run()
|
|
1546
|
-
|
|
1547
|
-
self.assertEqual(11, len(captured[task.EVENT_UPDATE_PROGRESS]))
|
|
1548
|
-
|
|
1549
|
-
def test_custom_notifications_proxied(self):
|
|
1550
|
-
captured = collections.defaultdict(list)
|
|
1551
|
-
|
|
1552
|
-
def notify_me(event_type, details):
|
|
1553
|
-
captured[event_type].append(details)
|
|
1554
|
-
|
|
1555
|
-
a = utils.EmittingTask('a')
|
|
1556
|
-
a.notifier.register(a.notifier.ANY, notify_me)
|
|
1557
|
-
e = self._make_engine(a)
|
|
1558
|
-
e.run()
|
|
1559
|
-
|
|
1560
|
-
self.assertEqual(1, len(captured['hi']))
|
|
1561
|
-
self.assertEqual(2, len(captured[task.EVENT_UPDATE_PROGRESS]))
|
|
1562
|
-
|
|
1563
|
-
def test_just_custom_notifications_proxied(self):
|
|
1564
|
-
captured = collections.defaultdict(list)
|
|
1565
|
-
|
|
1566
|
-
def notify_me(event_type, details):
|
|
1567
|
-
captured[event_type].append(details)
|
|
1568
|
-
|
|
1569
|
-
a = utils.EmittingTask('a')
|
|
1570
|
-
a.notifier.register('hi', notify_me)
|
|
1571
|
-
e = self._make_engine(a)
|
|
1572
|
-
e.run()
|
|
1573
|
-
|
|
1574
|
-
self.assertEqual(1, len(captured['hi']))
|
|
1575
|
-
self.assertEqual(0, len(captured[task.EVENT_UPDATE_PROGRESS]))
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
1495
|
class WorkerBasedEngineTest(EngineTaskTest,
|
|
1579
1496
|
EngineMultipleResultsTest,
|
|
1580
1497
|
EngineLinearFlowTest,
|
|
@@ -1589,7 +1506,7 @@ class WorkerBasedEngineTest(EngineTaskTest,
|
|
|
1589
1506
|
EngineTaskNotificationsTest,
|
|
1590
1507
|
test.TestCase):
|
|
1591
1508
|
def setUp(self):
|
|
1592
|
-
super(
|
|
1509
|
+
super().setUp()
|
|
1593
1510
|
shared_conf = {
|
|
1594
1511
|
'exchange': 'test',
|
|
1595
1512
|
'transport': 'memory',
|
|
@@ -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
|
|
@@ -44,7 +42,7 @@ class TestExceptions(test.TestCase):
|
|
|
44
42
|
def test_raise_with(self):
|
|
45
43
|
capture = None
|
|
46
44
|
try:
|
|
47
|
-
raise
|
|
45
|
+
raise OSError('broken')
|
|
48
46
|
except Exception:
|
|
49
47
|
try:
|
|
50
48
|
exc.raise_with_cause(exc.TaskFlowException, 'broken')
|
|
@@ -73,8 +71,8 @@ class TestExceptions(test.TestCase):
|
|
|
73
71
|
try:
|
|
74
72
|
try:
|
|
75
73
|
try:
|
|
76
|
-
raise
|
|
77
|
-
except
|
|
74
|
+
raise OSError("Didn't work")
|
|
75
|
+
except OSError:
|
|
78
76
|
exc.raise_with_cause(exc.TaskFlowException,
|
|
79
77
|
"It didn't go so well")
|
|
80
78
|
except exc.TaskFlowException:
|
|
@@ -109,7 +107,7 @@ class TestExceptions(test.TestCase):
|
|
|
109
107
|
def test_raise_with_cause(self):
|
|
110
108
|
capture = None
|
|
111
109
|
try:
|
|
112
|
-
raise
|
|
110
|
+
raise OSError('broken')
|
|
113
111
|
except Exception:
|
|
114
112
|
try:
|
|
115
113
|
exc.raise_with_cause(exc.TaskFlowException, 'broken')
|
|
@@ -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
|
|
@@ -37,7 +35,7 @@ def _make_exc_info(msg):
|
|
|
37
35
|
return sys.exc_info()
|
|
38
36
|
|
|
39
37
|
|
|
40
|
-
class GeneralFailureObjTestsMixin
|
|
38
|
+
class GeneralFailureObjTestsMixin:
|
|
41
39
|
|
|
42
40
|
def test_captures_message(self):
|
|
43
41
|
self.assertEqual('Woot!', self.fail_obj.exception_str)
|
|
@@ -72,7 +70,7 @@ class GeneralFailureObjTestsMixin(object):
|
|
|
72
70
|
class CaptureFailureTestCase(test.TestCase, GeneralFailureObjTestsMixin):
|
|
73
71
|
|
|
74
72
|
def setUp(self):
|
|
75
|
-
super(
|
|
73
|
+
super().setUp()
|
|
76
74
|
self.fail_obj = _captured_failure('Woot!')
|
|
77
75
|
|
|
78
76
|
def test_captures_value(self):
|
|
@@ -91,7 +89,7 @@ class CaptureFailureTestCase(test.TestCase, GeneralFailureObjTestsMixin):
|
|
|
91
89
|
class ReCreatedFailureTestCase(test.TestCase, GeneralFailureObjTestsMixin):
|
|
92
90
|
|
|
93
91
|
def setUp(self):
|
|
94
|
-
super(
|
|
92
|
+
super().setUp()
|
|
95
93
|
fail_obj = _captured_failure('Woot!')
|
|
96
94
|
self.fail_obj = failure.Failure(exception_str=fail_obj.exception_str,
|
|
97
95
|
traceback_str=fail_obj.traceback_str,
|
|
@@ -124,7 +122,7 @@ class ReCreatedFailureTestCase(test.TestCase, GeneralFailureObjTestsMixin):
|
|
|
124
122
|
class FromExceptionTestCase(test.TestCase, GeneralFailureObjTestsMixin):
|
|
125
123
|
|
|
126
124
|
def setUp(self):
|
|
127
|
-
super(
|
|
125
|
+
super().setUp()
|
|
128
126
|
self.fail_obj = failure.Failure.from_exception(RuntimeError('Woot!'))
|
|
129
127
|
|
|
130
128
|
def test_pformat_no_traceback(self):
|
|
@@ -333,24 +331,24 @@ class NonAsciiExceptionsTestCase(test.TestCase):
|
|
|
333
331
|
excp = ValueError(bad_string)
|
|
334
332
|
fail = failure.Failure.from_exception(excp)
|
|
335
333
|
self.assertEqual(str(excp), fail.exception_str)
|
|
336
|
-
expected =
|
|
334
|
+
expected = 'Failure: ValueError: \xc8'
|
|
337
335
|
self.assertEqual(expected, str(fail))
|
|
338
336
|
|
|
339
337
|
def test_exception_non_ascii_unicode(self):
|
|
340
|
-
hi_ru =
|
|
338
|
+
hi_ru = 'привет'
|
|
341
339
|
fail = failure.Failure.from_exception(ValueError(hi_ru))
|
|
342
340
|
self.assertEqual(hi_ru, fail.exception_str)
|
|
343
341
|
self.assertIsInstance(fail.exception_str, str)
|
|
344
|
-
self.assertEqual(
|
|
342
|
+
self.assertEqual('Failure: ValueError: %s' % hi_ru,
|
|
345
343
|
str(fail))
|
|
346
344
|
|
|
347
345
|
def test_wrapped_failure_non_ascii_unicode(self):
|
|
348
|
-
hi_cn =
|
|
346
|
+
hi_cn = '嗨'
|
|
349
347
|
fail = ValueError(hi_cn)
|
|
350
348
|
self.assertEqual(hi_cn, str(fail))
|
|
351
349
|
fail = failure.Failure.from_exception(fail)
|
|
352
350
|
wrapped_fail = exceptions.WrappedFailure([fail])
|
|
353
|
-
expected_result = (
|
|
351
|
+
expected_result = ("WrappedFailure: "
|
|
354
352
|
"[Failure: ValueError: %s]" % (hi_cn))
|
|
355
353
|
self.assertEqual(expected_result, str(wrapped_fail))
|
|
356
354
|
|
|
@@ -361,7 +359,7 @@ class NonAsciiExceptionsTestCase(test.TestCase):
|
|
|
361
359
|
self.assertEqual(fail, copied)
|
|
362
360
|
|
|
363
361
|
def test_failure_equality_non_ascii_unicode(self):
|
|
364
|
-
hi_ru =
|
|
362
|
+
hi_ru = 'привет'
|
|
365
363
|
fail = failure.Failure.from_exception(ValueError(hi_ru))
|
|
366
364
|
copied = fail.copy()
|
|
367
365
|
self.assertEqual(fail, copied)
|