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.
Files changed (204) hide show
  1. taskflow/atom.py +3 -5
  2. taskflow/conductors/backends/__init__.py +0 -2
  3. taskflow/conductors/backends/impl_blocking.py +1 -3
  4. taskflow/conductors/backends/impl_executor.py +3 -6
  5. taskflow/conductors/backends/impl_nonblocking.py +1 -3
  6. taskflow/conductors/base.py +1 -3
  7. taskflow/deciders.py +0 -2
  8. taskflow/engines/__init__.py +0 -2
  9. taskflow/engines/action_engine/actions/base.py +1 -3
  10. taskflow/engines/action_engine/actions/retry.py +1 -3
  11. taskflow/engines/action_engine/actions/task.py +1 -3
  12. taskflow/engines/action_engine/builder.py +2 -4
  13. taskflow/engines/action_engine/compiler.py +9 -11
  14. taskflow/engines/action_engine/completer.py +5 -7
  15. taskflow/engines/action_engine/deciders.py +1 -3
  16. taskflow/engines/action_engine/engine.py +4 -26
  17. taskflow/engines/action_engine/executor.py +2 -4
  18. taskflow/engines/action_engine/runtime.py +1 -3
  19. taskflow/engines/action_engine/scheduler.py +3 -5
  20. taskflow/engines/action_engine/scopes.py +3 -5
  21. taskflow/engines/action_engine/selector.py +1 -3
  22. taskflow/engines/action_engine/traversal.py +0 -2
  23. taskflow/engines/base.py +1 -3
  24. taskflow/engines/helpers.py +0 -2
  25. taskflow/engines/worker_based/dispatcher.py +2 -4
  26. taskflow/engines/worker_based/endpoint.py +1 -3
  27. taskflow/engines/worker_based/engine.py +1 -4
  28. taskflow/engines/worker_based/executor.py +0 -2
  29. taskflow/engines/worker_based/protocol.py +1 -3
  30. taskflow/engines/worker_based/proxy.py +2 -4
  31. taskflow/engines/worker_based/server.py +3 -5
  32. taskflow/engines/worker_based/types.py +6 -7
  33. taskflow/engines/worker_based/worker.py +4 -6
  34. taskflow/examples/99_bottles.py +0 -2
  35. taskflow/examples/alphabet_soup.py +0 -2
  36. taskflow/examples/build_a_car.py +1 -3
  37. taskflow/examples/buildsystem.py +1 -3
  38. taskflow/examples/calculate_in_parallel.py +1 -3
  39. taskflow/examples/calculate_linear.py +3 -5
  40. taskflow/examples/create_parallel_volume.py +2 -5
  41. taskflow/examples/delayed_return.py +1 -3
  42. taskflow/examples/distance_calculator.py +12 -24
  43. taskflow/examples/dump_memory_backend.py +1 -3
  44. taskflow/examples/echo_listener.py +0 -2
  45. taskflow/examples/example_utils.py +1 -3
  46. taskflow/examples/fake_billing.py +9 -11
  47. taskflow/examples/graph_flow.py +2 -4
  48. taskflow/examples/hello_world.py +2 -4
  49. taskflow/examples/jobboard_produce_consume_colors.py +3 -5
  50. taskflow/examples/parallel_table_multiply.py +1 -3
  51. taskflow/examples/persistence_example.py +1 -3
  52. taskflow/examples/pseudo_scoping.py +2 -4
  53. taskflow/examples/resume_from_backend.py +1 -3
  54. taskflow/examples/resume_many_flows/my_flows.py +0 -2
  55. taskflow/examples/resume_many_flows/resume_all.py +1 -3
  56. taskflow/examples/resume_many_flows/run_flow.py +2 -4
  57. taskflow/examples/resume_many_flows.py +0 -2
  58. taskflow/examples/resume_vm_boot.py +12 -15
  59. taskflow/examples/resume_volume_create.py +3 -5
  60. taskflow/examples/retry_flow.py +0 -2
  61. taskflow/examples/reverting_linear.py +1 -3
  62. taskflow/examples/run_by_iter.py +0 -2
  63. taskflow/examples/run_by_iter_enumerate.py +1 -3
  64. taskflow/examples/share_engine_thread.py +2 -4
  65. taskflow/examples/simple_linear.py +0 -2
  66. taskflow/examples/simple_linear_listening.py +1 -3
  67. taskflow/examples/simple_linear_pass.py +0 -2
  68. taskflow/examples/simple_map_reduce.py +0 -2
  69. taskflow/examples/switch_graph_flow.py +1 -3
  70. taskflow/examples/timing_listener.py +1 -3
  71. taskflow/examples/tox_conductor.py +3 -5
  72. taskflow/examples/wbe_event_sender.py +0 -2
  73. taskflow/examples/wbe_mandelbrot.py +0 -2
  74. taskflow/examples/wbe_simple_linear.py +0 -2
  75. taskflow/examples/wrapped_exception.py +0 -2
  76. taskflow/exceptions.py +7 -9
  77. taskflow/flow.py +1 -3
  78. taskflow/formatters.py +22 -8
  79. taskflow/jobs/backends/__init__.py +0 -2
  80. taskflow/jobs/backends/impl_redis.py +22 -18
  81. taskflow/jobs/backends/impl_zookeeper.py +7 -8
  82. taskflow/jobs/base.py +5 -7
  83. taskflow/listeners/base.py +1 -3
  84. taskflow/listeners/capturing.py +1 -3
  85. taskflow/listeners/claims.py +1 -3
  86. taskflow/listeners/logging.py +10 -6
  87. taskflow/listeners/printing.py +1 -3
  88. taskflow/listeners/timing.py +10 -13
  89. taskflow/logging.py +0 -2
  90. taskflow/patterns/graph_flow.py +2 -4
  91. taskflow/patterns/linear_flow.py +4 -9
  92. taskflow/patterns/unordered_flow.py +4 -9
  93. taskflow/persistence/backends/__init__.py +1 -3
  94. taskflow/persistence/backends/impl_dir.py +3 -6
  95. taskflow/persistence/backends/impl_memory.py +6 -9
  96. taskflow/persistence/backends/impl_sqlalchemy.py +4 -6
  97. taskflow/persistence/backends/impl_zookeeper.py +2 -4
  98. taskflow/persistence/backends/sqlalchemy/alembic/env.py +0 -2
  99. taskflow/persistence/backends/sqlalchemy/alembic/versions/00af93df9d77_add_unique_into_all_indexes.py +80 -0
  100. taskflow/persistence/backends/sqlalchemy/alembic/versions/14b227d79a87_add_intention_column.py +0 -2
  101. taskflow/persistence/backends/sqlalchemy/alembic/versions/1c783c0c2875_replace_exception_an.py +0 -2
  102. taskflow/persistence/backends/sqlalchemy/alembic/versions/1cea328f0f65_initial_logbook_deta.py +0 -2
  103. taskflow/persistence/backends/sqlalchemy/alembic/versions/2ad4984f2864_switch_postgres_to_json_native.py +0 -2
  104. taskflow/persistence/backends/sqlalchemy/alembic/versions/3162c0f3f8e4_add_revert_results_and_revert_failure_.py +0 -2
  105. taskflow/persistence/backends/sqlalchemy/alembic/versions/589dccdf2b6e_rename_taskdetails_to_atomdetails.py +0 -2
  106. taskflow/persistence/backends/sqlalchemy/alembic/versions/84d6e888850_add_task_detail_type.py +0 -2
  107. taskflow/persistence/backends/sqlalchemy/tables.py +0 -2
  108. taskflow/persistence/base.py +2 -4
  109. taskflow/persistence/models.py +19 -24
  110. taskflow/persistence/path_based.py +1 -3
  111. taskflow/retry.py +12 -18
  112. taskflow/states.py +0 -2
  113. taskflow/storage.py +9 -11
  114. taskflow/task.py +15 -18
  115. taskflow/test.py +5 -5
  116. taskflow/tests/test_examples.py +0 -2
  117. taskflow/tests/unit/action_engine/test_builder.py +1 -3
  118. taskflow/tests/unit/action_engine/test_compile.py +4 -6
  119. taskflow/tests/unit/action_engine/test_creation.py +0 -21
  120. taskflow/tests/unit/action_engine/test_scoping.py +1 -3
  121. taskflow/tests/unit/jobs/base.py +1 -3
  122. taskflow/tests/unit/jobs/test_entrypoint.py +0 -2
  123. taskflow/tests/unit/jobs/test_redis_job.py +1 -3
  124. taskflow/tests/unit/jobs/test_zk_job.py +2 -4
  125. taskflow/tests/unit/patterns/test_graph_flow.py +18 -20
  126. taskflow/tests/unit/patterns/test_linear_flow.py +7 -9
  127. taskflow/tests/unit/patterns/test_unordered_flow.py +12 -14
  128. taskflow/tests/unit/persistence/base.py +2 -4
  129. taskflow/tests/unit/persistence/test_dir_persistence.py +2 -4
  130. taskflow/tests/unit/persistence/test_memory_persistence.py +2 -4
  131. taskflow/tests/unit/persistence/test_sql_persistence.py +4 -6
  132. taskflow/tests/unit/persistence/test_zk_persistence.py +2 -4
  133. taskflow/tests/unit/test_arguments_passing.py +3 -25
  134. taskflow/tests/unit/test_check_transition.py +3 -5
  135. taskflow/tests/unit/test_conductors.py +0 -2
  136. taskflow/tests/unit/test_deciders.py +1 -3
  137. taskflow/tests/unit/test_engine_helpers.py +0 -2
  138. taskflow/tests/unit/test_engines.py +19 -102
  139. taskflow/tests/unit/test_exceptions.py +4 -6
  140. taskflow/tests/unit/test_failure.py +10 -12
  141. taskflow/tests/unit/test_flow_dependencies.py +62 -64
  142. taskflow/tests/unit/test_formatters.py +0 -2
  143. taskflow/tests/unit/test_functor_task.py +1 -3
  144. taskflow/tests/unit/test_listeners.py +9 -11
  145. taskflow/tests/unit/test_mapfunctor_task.py +1 -3
  146. taskflow/tests/unit/test_notifier.py +1 -3
  147. taskflow/tests/unit/test_progress.py +2 -4
  148. taskflow/tests/unit/test_reducefunctor_task.py +1 -3
  149. taskflow/tests/unit/test_retries.py +1 -25
  150. taskflow/tests/unit/test_states.py +0 -2
  151. taskflow/tests/unit/test_storage.py +10 -12
  152. taskflow/tests/unit/test_suspend.py +2 -23
  153. taskflow/tests/unit/test_task.py +17 -19
  154. taskflow/tests/unit/test_types.py +4 -6
  155. taskflow/tests/unit/test_utils.py +9 -11
  156. taskflow/tests/unit/test_utils_async_utils.py +0 -2
  157. taskflow/tests/unit/test_utils_binary.py +12 -14
  158. taskflow/tests/unit/test_utils_iter_utils.py +1 -3
  159. taskflow/tests/unit/test_utils_kazoo_utils.py +0 -2
  160. taskflow/tests/unit/test_utils_threading_utils.py +1 -3
  161. taskflow/tests/unit/worker_based/test_creation.py +0 -2
  162. taskflow/tests/unit/worker_based/test_dispatcher.py +0 -2
  163. taskflow/tests/unit/worker_based/test_endpoint.py +2 -4
  164. taskflow/tests/unit/worker_based/test_executor.py +1 -3
  165. taskflow/tests/unit/worker_based/test_message_pump.py +0 -2
  166. taskflow/tests/unit/worker_based/test_pipeline.py +0 -2
  167. taskflow/tests/unit/worker_based/test_protocol.py +2 -4
  168. taskflow/tests/unit/worker_based/test_proxy.py +2 -4
  169. taskflow/tests/unit/worker_based/test_server.py +3 -5
  170. taskflow/tests/unit/worker_based/test_types.py +0 -2
  171. taskflow/tests/unit/worker_based/test_worker.py +1 -3
  172. taskflow/tests/utils.py +11 -15
  173. taskflow/types/entity.py +1 -3
  174. taskflow/types/failure.py +3 -6
  175. taskflow/types/graph.py +14 -18
  176. taskflow/types/latch.py +1 -3
  177. taskflow/types/notifier.py +6 -9
  178. taskflow/types/sets.py +2 -5
  179. taskflow/types/timing.py +1 -3
  180. taskflow/types/tree.py +6 -10
  181. taskflow/utils/async_utils.py +0 -2
  182. taskflow/utils/banner.py +8 -9
  183. taskflow/utils/eventlet_utils.py +2 -2
  184. taskflow/utils/iter_utils.py +0 -2
  185. taskflow/utils/kazoo_utils.py +7 -9
  186. taskflow/utils/kombu_utils.py +5 -7
  187. taskflow/utils/misc.py +4 -6
  188. taskflow/utils/persistence_utils.py +0 -2
  189. taskflow/utils/redis_utils.py +2 -4
  190. taskflow/utils/schema_utils.py +0 -2
  191. taskflow/utils/threading_utils.py +1 -3
  192. taskflow/version.py +1 -3
  193. {taskflow-5.11.0.dist-info → taskflow-6.0.0.dist-info}/AUTHORS +1 -0
  194. {taskflow-5.11.0.dist-info → taskflow-6.0.0.dist-info}/METADATA +2 -1
  195. taskflow-6.0.0.dist-info/RECORD +243 -0
  196. {taskflow-5.11.0.dist-info → taskflow-6.0.0.dist-info}/WHEEL +1 -1
  197. taskflow-6.0.0.dist-info/pbr.json +1 -0
  198. taskflow/engines/action_engine/process_executor.py +0 -720
  199. taskflow/tests/unit/action_engine/test_process_executor.py +0 -106
  200. taskflow-5.11.0.dist-info/RECORD +0 -244
  201. taskflow-5.11.0.dist-info/pbr.json +0 -1
  202. {taskflow-5.11.0.dist-info → taskflow-6.0.0.dist-info}/LICENSE +0 -0
  203. {taskflow-5.11.0.dist-info → taskflow-6.0.0.dist-info}/entry_points.txt +0 -0
  204. {taskflow-5.11.0.dist-info → taskflow-6.0.0.dist-info}/top_level.txt +0 -0
taskflow/atom.py CHANGED
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2013 Rackspace Hosting Inc. All Rights Reserved.
4
2
  # Copyright (C) 2013 Yahoo! Inc. All Rights Reserved.
5
3
  #
@@ -159,7 +157,7 @@ def _build_arg_mapping(atom_name, reqs, rebind_args, function, do_infer,
159
157
  return required, optional
160
158
 
161
159
 
162
- class Atom(object, metaclass=abc.ABCMeta):
160
+ class Atom(metaclass=abc.ABCMeta):
163
161
  """An unit of work that causes a flow to progress (in some manner).
164
162
 
165
163
  An atom is a named object that operates with input data to perform
@@ -379,7 +377,7 @@ class Atom(object, metaclass=abc.ABCMeta):
379
377
  """
380
378
 
381
379
  def __str__(self):
382
- return '"%s==%s"' % (self.name, misc.get_version_string(self))
380
+ return '"{}=={}"'.format(self.name, misc.get_version_string(self))
383
381
 
384
382
  def __repr__(self):
385
- return '<%s %s>' % (reflection.get_class_name(self), self)
383
+ return '<{} {}>'.format(reflection.get_class_name(self), self)
@@ -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
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
4
2
  # not use this file except in compliance with the License. You may obtain
5
3
  # a copy of the License at
@@ -33,7 +31,7 @@ class BlockingConductor(impl_executor.ExecutorConductor):
33
31
  persistence=None, engine=None,
34
32
  engine_options=None, wait_timeout=None,
35
33
  log=None, max_simultaneous_jobs=MAX_SIMULTANEOUS_JOBS):
36
- super(BlockingConductor, self).__init__(
34
+ super().__init__(
37
35
  name, jobboard,
38
36
  persistence=persistence, engine=engine,
39
37
  engine_options=engine_options,
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
4
2
  # not use this file except in compliance with the License. You may obtain
5
3
  # a copy of the License at
@@ -104,7 +102,7 @@ class ExecutorConductor(base.Conductor, metaclass=abc.ABCMeta):
104
102
  persistence=None, engine=None,
105
103
  engine_options=None, wait_timeout=None,
106
104
  log=None, max_simultaneous_jobs=MAX_SIMULTANEOUS_JOBS):
107
- super(ExecutorConductor, self).__init__(
105
+ super().__init__(
108
106
  name, jobboard, persistence=persistence,
109
107
  engine=engine, engine_options=engine_options)
110
108
  self._wait_timeout = tt.convert_to_timeout(
@@ -139,8 +137,7 @@ class ExecutorConductor(base.Conductor, metaclass=abc.ABCMeta):
139
137
  return not self._dead.is_set()
140
138
 
141
139
  def _listeners_from_job(self, job, engine):
142
- listeners = super(ExecutorConductor, self)._listeners_from_job(
143
- job, engine)
140
+ listeners = super()._listeners_from_job(job, engine)
144
141
  listeners.append(logging_listener.LoggingListener(engine,
145
142
  log=self._log))
146
143
  return listeners
@@ -178,7 +175,7 @@ class ExecutorConductor(base.Conductor, metaclass=abc.ABCMeta):
178
175
  stage_func()
179
176
  self._notifier.notify("%s_end" % event_name, details)
180
177
  except excp.WrappedFailure as e:
181
- if all((f.check(*self.NO_CONSUME_EXCEPTIONS) for f in e)):
178
+ if all(f.check(*self.NO_CONSUME_EXCEPTIONS) for f in e):
182
179
  consume = False
183
180
  if self._log.isEnabledFor(logging.WARNING):
184
181
  if consume:
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
4
2
  # not use this file except in compliance with the License. You may obtain
5
3
  # a copy of the License at
@@ -54,7 +52,7 @@ class NonBlockingConductor(impl_executor.ExecutorConductor):
54
52
  engine_options=None, wait_timeout=None,
55
53
  log=None, max_simultaneous_jobs=MAX_SIMULTANEOUS_JOBS,
56
54
  executor_factory=None):
57
- super(NonBlockingConductor, self).__init__(
55
+ super().__init__(
58
56
  name, jobboard,
59
57
  persistence=persistence, engine=engine,
60
58
  engine_options=engine_options, wait_timeout=wait_timeout,
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
4
2
  # not use this file except in compliance with the License. You may obtain
5
3
  # a copy of the License at
@@ -25,7 +23,7 @@ from taskflow.types import notifier
25
23
  from taskflow.utils import misc
26
24
 
27
25
 
28
- class Conductor(object, metaclass=abc.ABCMeta):
26
+ class Conductor(metaclass=abc.ABCMeta):
29
27
  """Base for all conductor implementations.
30
28
 
31
29
  Conductors act as entities which extract jobs from a jobboard, assign
taskflow/deciders.py CHANGED
@@ -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
@@ -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
@@ -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
@@ -19,7 +17,7 @@ import abc
19
17
  from taskflow import states
20
18
 
21
19
 
22
- class Action(object, metaclass=abc.ABCMeta):
20
+ class Action(metaclass=abc.ABCMeta):
23
21
  """An action that handles executing, state changes, ... of atoms."""
24
22
 
25
23
  NO_RESULT = object()
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2012-2013 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -24,7 +22,7 @@ class RetryAction(base.Action):
24
22
  """An action that handles executing, state changes, ... of retry atoms."""
25
23
 
26
24
  def __init__(self, storage, notifier, retry_executor):
27
- super(RetryAction, self).__init__(storage, notifier)
25
+ super().__init__(storage, notifier)
28
26
  self._retry_executor = retry_executor
29
27
 
30
28
  def _get_retry_args(self, retry, revert=False, addons=None):
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # Copyright (C) 2012-2013 Yahoo! Inc. All Rights Reserved.
4
2
  #
5
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -29,7 +27,7 @@ class TaskAction(base.Action):
29
27
  """An action that handles scheduling, state changes, ... of task atoms."""
30
28
 
31
29
  def __init__(self, storage, notifier, task_executor):
32
- super(TaskAction, self).__init__(storage, notifier)
30
+ super().__init__(storage, notifier)
33
31
  self._task_executor = task_executor
34
32
 
35
33
  def _is_identity_transition(self, old_state, state, task, progress=None):
@@ -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
@@ -58,7 +56,7 @@ TIMED_STATES = (st.ANALYZING, st.RESUMING, st.SCHEDULING, st.WAITING)
58
56
  LOG = logging.getLogger(__name__)
59
57
 
60
58
 
61
- class MachineMemory(object):
59
+ class MachineMemory:
62
60
  """State machine memory."""
63
61
 
64
62
  def __init__(self):
@@ -73,7 +71,7 @@ class MachineMemory(object):
73
71
  fut.cancel()
74
72
 
75
73
 
76
- class MachineBuilder(object):
74
+ class MachineBuilder:
77
75
  """State machine *builder* that powers the engine components.
78
76
 
79
77
  NOTE(harlowja): the machine (states and events that will trigger
@@ -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
@@ -46,12 +44,12 @@ ATOMS = (TASK, RETRY)
46
44
  FLOWS = (FLOW, FLOW_END)
47
45
 
48
46
 
49
- class Terminator(object):
47
+ class Terminator:
50
48
  """Flow terminator class."""
51
49
 
52
50
  def __init__(self, flow):
53
51
  self._flow = flow
54
- self._name = "%s[$]" % (self._flow.name,)
52
+ self._name = "{}[$]".format(self._flow.name)
55
53
 
56
54
  @property
57
55
  def flow(self):
@@ -68,7 +66,7 @@ class Terminator(object):
68
66
  return '"%s[$]"' % flow_name
69
67
 
70
68
 
71
- class Compilation(object):
69
+ class Compilation:
72
70
  """The result of a compilers ``compile()`` is this *immutable* object."""
73
71
 
74
72
  #: Task nodes will have a ``kind`` metadata key with this value.
@@ -135,7 +133,7 @@ def _add_update_edges(graph, nodes_from, nodes_to, attr_dict=None):
135
133
  graph.add_edge(u, v, attr_dict=attr_dict.copy())
136
134
 
137
135
 
138
- class TaskCompiler(object):
136
+ class TaskCompiler:
139
137
  """Non-recursive compiler of tasks."""
140
138
 
141
139
  def compile(self, task, parent=None):
@@ -147,7 +145,7 @@ class TaskCompiler(object):
147
145
  return graph, node
148
146
 
149
147
 
150
- class FlowCompiler(object):
148
+ class FlowCompiler:
151
149
  """Recursive compiler of flows."""
152
150
 
153
151
  def __init__(self, deep_compiler_func):
@@ -162,9 +160,9 @@ class FlowCompiler(object):
162
160
  parent.add(tree_node)
163
161
  if flow.retry is not None:
164
162
  tree_node.add(tr.Node(flow.retry, kind=RETRY))
165
- decomposed = dict(
166
- (child, self._deep_compiler_func(child, parent=tree_node)[0])
167
- for child in flow)
163
+ decomposed = {
164
+ child: self._deep_compiler_func(child, parent=tree_node)[0]
165
+ for child in flow}
168
166
  decomposed_graphs = list(decomposed.values())
169
167
  graph = gr.merge_graphs(graph, *decomposed_graphs,
170
168
  overlap_detector=_overlap_occurrence_detector)
@@ -223,7 +221,7 @@ class FlowCompiler(object):
223
221
  return graph, tree_node
224
222
 
225
223
 
226
- class PatternCompiler(object):
224
+ class PatternCompiler:
227
225
  """Compiles a flow pattern (or task) into a compilation unit.
228
226
 
229
227
  Let's dive into the basic idea for how this works:
@@ -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
@@ -29,7 +27,7 @@ from taskflow import states as st
29
27
  LOG = logging.getLogger(__name__)
30
28
 
31
29
 
32
- class Strategy(object, metaclass=abc.ABCMeta):
30
+ class Strategy(metaclass=abc.ABCMeta):
33
31
  """Failure resolution strategy base class."""
34
32
 
35
33
  strategy = None
@@ -56,7 +54,7 @@ class RevertAndRetry(Strategy):
56
54
  strategy = retry_atom.RETRY
57
55
 
58
56
  def __init__(self, runtime, retry):
59
- super(RevertAndRetry, self).__init__(runtime)
57
+ super().__init__(runtime)
60
58
  self._retry = retry
61
59
 
62
60
  def apply(self):
@@ -73,7 +71,7 @@ class RevertAll(Strategy):
73
71
  strategy = retry_atom.REVERT_ALL
74
72
 
75
73
  def __init__(self, runtime):
76
- super(RevertAll, self).__init__(runtime)
74
+ super().__init__(runtime)
77
75
 
78
76
  def apply(self):
79
77
  return self._runtime.reset_atoms(
@@ -87,7 +85,7 @@ class Revert(Strategy):
87
85
  strategy = retry_atom.REVERT
88
86
 
89
87
  def __init__(self, runtime, atom):
90
- super(Revert, self).__init__(runtime)
88
+ super().__init__(runtime)
91
89
  self._atom = atom
92
90
 
93
91
  def apply(self):
@@ -98,7 +96,7 @@ class Revert(Strategy):
98
96
  return tweaked
99
97
 
100
98
 
101
- class Completer(object):
99
+ class Completer:
102
100
  """Completes atoms using actions to complete them."""
103
101
 
104
102
  def __init__(self, runtime):
@@ -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
@@ -26,7 +24,7 @@ from taskflow import states
26
24
  LOG = logging.getLogger(__name__)
27
25
 
28
26
 
29
- class Decider(object, metaclass=abc.ABCMeta):
27
+ class Decider(metaclass=abc.ABCMeta):
30
28
  """Base class for deciders.
31
29
 
32
30
  Provides interface to be implemented by sub-classes.
@@ -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
@@ -40,11 +38,6 @@ from taskflow import storage
40
38
  from taskflow.types import failure
41
39
  from taskflow.utils import misc
42
40
 
43
- try:
44
- from taskflow.engines.action_engine import process_executor
45
- except ImportError:
46
- process_executor = None
47
-
48
41
  LOG = logging.getLogger(__name__)
49
42
 
50
43
 
@@ -170,7 +163,7 @@ class ActionEngine(base.Engine):
170
163
  """
171
164
 
172
165
  def __init__(self, flow, flow_detail, backend, options):
173
- super(ActionEngine, self).__init__(flow, flow_detail, backend, options)
166
+ super().__init__(flow, flow_detail, backend, options)
174
167
  self._runtime = None
175
168
  self._compiled = False
176
169
  self._compilation = None
@@ -479,8 +472,7 @@ class SerialActionEngine(ActionEngine):
479
472
  """Engine that runs tasks in serial manner."""
480
473
 
481
474
  def __init__(self, flow, flow_detail, backend, options):
482
- super(SerialActionEngine, self).__init__(flow, flow_detail,
483
- backend, options)
475
+ super().__init__(flow, flow_detail, backend, options)
484
476
  self._task_executor = executor.SerialTaskExecutor()
485
477
 
486
478
 
@@ -548,7 +540,6 @@ String (case insensitive) Executor used
548
540
  polling while a higher number will involve less polling but a slower time
549
541
  for an engine to notice a task has completed.
550
542
 
551
- .. |pe| replace:: process_executor
552
543
  .. |cfp| replace:: concurrent.futures.process
553
544
  .. |cft| replace:: concurrent.futures.thread
554
545
  .. |cf| replace:: concurrent.futures
@@ -563,16 +554,9 @@ String (case insensitive) Executor used
563
554
  _executor_cls_matchers = [
564
555
  _ExecutorTypeMatch((futures.ThreadPoolExecutor,),
565
556
  executor.ParallelThreadTaskExecutor),
566
- ]
567
- if process_executor is not None:
568
- _executor_cls_matchers.append(
569
- _ExecutorTypeMatch((futures.ProcessPoolExecutor,),
570
- process_executor.ParallelProcessTaskExecutor)
571
- )
572
- _executor_cls_matchers.append(
573
557
  _ExecutorTypeMatch((futures.Executor,),
574
558
  executor.ParallelThreadTaskExecutor),
575
- )
559
+ ]
576
560
 
577
561
  # One of these should match when a string/text is provided for the
578
562
  # 'executor' option (a mixed case equivalent is allowed since the match
@@ -584,18 +568,12 @@ String (case insensitive) Executor used
584
568
  'greenthreaded']),
585
569
  executor.ParallelGreenThreadTaskExecutor),
586
570
  ]
587
- if process_executor is not None:
588
- _executor_str_matchers.append(
589
- _ExecutorTextMatch(frozenset(['processes', 'process']),
590
- process_executor.ParallelProcessTaskExecutor)
591
- )
592
571
 
593
572
  # Used when no executor is provided (either a string or object)...
594
573
  _default_executor_cls = executor.ParallelThreadTaskExecutor
595
574
 
596
575
  def __init__(self, flow, flow_detail, backend, options):
597
- super(ParallelActionEngine, self).__init__(flow, flow_detail,
598
- backend, options)
576
+ super().__init__(flow, flow_detail, backend, options)
599
577
  # This ensures that any provided executor will be validated before
600
578
  # we get to far in the compilation/execution pipeline...
601
579
  self._task_executor = self._fetch_task_executor(self._options)
@@ -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
@@ -78,7 +76,7 @@ def _revert_task(task, arguments, result, failures, progress_callback=None):
78
76
  return (REVERTED, result)
79
77
 
80
78
 
81
- class SerialRetryExecutor(object):
79
+ class SerialRetryExecutor:
82
80
  """Executes and reverts retries."""
83
81
 
84
82
  def __init__(self):
@@ -105,7 +103,7 @@ class SerialRetryExecutor(object):
105
103
  return fut
106
104
 
107
105
 
108
- class TaskExecutor(object, metaclass=abc.ABCMeta):
106
+ class TaskExecutor(metaclass=abc.ABCMeta):
109
107
  """Executes and reverts tasks.
110
108
 
111
109
  This class takes task and its arguments and executes or reverts it.
@@ -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
@@ -43,7 +41,7 @@ _EdgeDecider = collections.namedtuple('_EdgeDecider',
43
41
  LOG = logging.getLogger(__name__)
44
42
 
45
43
 
46
- class Runtime(object):
44
+ class Runtime:
47
45
  """A aggregate of runtime objects, properties, ... used during execution.
48
46
 
49
47
  This object contains various utility methods and properties that represent
@@ -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
@@ -21,7 +19,7 @@ from taskflow import states as st
21
19
  from taskflow.types import failure
22
20
 
23
21
 
24
- class RetryScheduler(object):
22
+ class RetryScheduler:
25
23
  """Schedules retry atoms."""
26
24
 
27
25
  def __init__(self, runtime):
@@ -52,7 +50,7 @@ class RetryScheduler(object):
52
50
  " intention: %s" % intention)
53
51
 
54
52
 
55
- class TaskScheduler(object):
53
+ class TaskScheduler:
56
54
  """Schedules task atoms."""
57
55
 
58
56
  def __init__(self, runtime):
@@ -75,7 +73,7 @@ class TaskScheduler(object):
75
73
  " intention: %s" % intention)
76
74
 
77
75
 
78
- class Scheduler(object):
76
+ class Scheduler:
79
77
  """Safely schedules atoms using a runtime ``fetch_scheduler`` routine."""
80
78
 
81
79
  def __init__(self, runtime):
@@ -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
@@ -21,7 +19,7 @@ from taskflow import logging
21
19
  LOG = logging.getLogger(__name__)
22
20
 
23
21
 
24
- class ScopeWalker(object):
22
+ class ScopeWalker:
25
23
  """Walks through the scopes of a atom using a engines compilation.
26
24
 
27
25
  NOTE(harlowja): for internal usage only.
@@ -79,9 +77,9 @@ class ScopeWalker(object):
79
77
  """
80
78
  graph = self._execution_graph
81
79
  if self._predecessors is None:
82
- predecessors = set(
80
+ predecessors = {
83
81
  node for node in graph.bfs_predecessors_iter(self._atom)
84
- if graph.nodes[node]['kind'] in co.ATOMS)
82
+ if graph.nodes[node]['kind'] in co.ATOMS}
85
83
  self._predecessors = predecessors.copy()
86
84
  else:
87
85
  predecessors = self._predecessors.copy()
@@ -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
@@ -27,7 +25,7 @@ from taskflow.utils import iter_utils
27
25
  LOG = logging.getLogger(__name__)
28
26
 
29
27
 
30
- class Selector(object):
28
+ class Selector:
31
29
  """Selector that uses a compilation and aids in execution processes.
32
30
 
33
31
  Its primary purpose is to get the next atoms for execution or reversion
@@ -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
taskflow/engines/base.py CHANGED
@@ -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
@@ -21,7 +19,7 @@ from taskflow.types import notifier
21
19
  from taskflow.utils import misc
22
20
 
23
21
 
24
- class Engine(object, metaclass=abc.ABCMeta):
22
+ class Engine(metaclass=abc.ABCMeta):
25
23
  """Base for all engines implementations.
26
24
 
27
25
  :ivar Engine.notifier: A notification object that will dispatch
@@ -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
@@ -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
@@ -23,7 +21,7 @@ from taskflow.utils import kombu_utils as ku
23
21
  LOG = logging.getLogger(__name__)
24
22
 
25
23
 
26
- class Handler(object):
24
+ class Handler:
27
25
  """Component(s) that will be called on reception of messages."""
28
26
 
29
27
  __slots__ = ['_process_message', '_validator']
@@ -53,7 +51,7 @@ class Handler(object):
53
51
  return self._validator
54
52
 
55
53
 
56
- class TypeDispatcher(object):
54
+ class TypeDispatcher:
57
55
  """Receives messages and dispatches to type specific handlers."""
58
56
 
59
57
  def __init__(self, type_handlers=None, requeue_filters=None):
@@ -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
@@ -19,7 +17,7 @@ from oslo_utils import reflection
19
17
  from taskflow.engines.action_engine import executor
20
18
 
21
19
 
22
- class Endpoint(object):
20
+ class Endpoint:
23
21
  """Represents a single task with execute/revert methods."""
24
22
 
25
23
  def __init__(self, task_cls):
@@ -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
@@ -53,8 +51,7 @@ class WorkerBasedActionEngine(engine.ActionEngine):
53
51
  """
54
52
 
55
53
  def __init__(self, flow, flow_detail, backend, options):
56
- super(WorkerBasedActionEngine, self).__init__(flow, flow_detail,
57
- backend, options)
54
+ super().__init__(flow, flow_detail, backend, options)
58
55
  # This ensures that any provided executor will be validated before
59
56
  # we get to far in the compilation/execution pipeline...
60
57
  self._task_executor = self._fetch_task_executor(self._options,
@@ -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
@@ -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
@@ -147,7 +145,7 @@ def failure_to_dict(failure):
147
145
  return failure.to_dict(include_args=False)
148
146
 
149
147
 
150
- class Message(object, metaclass=abc.ABCMeta):
148
+ class Message(metaclass=abc.ABCMeta):
151
149
  """Base class for all message types."""
152
150
 
153
151
  def __repr__(self):
@@ -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
@@ -40,7 +38,7 @@ _TransportDetails = collections.namedtuple('_TransportDetails',
40
38
  'driver_name', 'driver_version'])
41
39
 
42
40
 
43
- class Proxy(object):
41
+ class Proxy:
44
42
  """A proxy processes messages from/to the named exchange.
45
43
 
46
44
  For **internal** usage only (not for public consumption).
@@ -145,7 +143,7 @@ class Proxy(object):
145
143
 
146
144
  def _make_queue(self, routing_key, exchange, channel=None):
147
145
  """Make a named queue for the given exchange."""
148
- queue_name = "%s_%s" % (self._exchange_name, routing_key)
146
+ queue_name = "{}_{}".format(self._exchange_name, routing_key)
149
147
  return kombu.Queue(name=queue_name,
150
148
  routing_key=routing_key, durable=False,
151
149
  exchange=exchange, auto_delete=True,