diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-06-29 04:39:29 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-06-29 04:39:29 +0000 |
commit | 766978c68e9346b972f84c7dc417678260b933b3 (patch) | |
tree | 2509248782889fb0aede6b47ca5f880ebeeb36b6 | |
parent | b8dab64a8c3c77d65b8b3cd77d054cc6137ac30f (diff) | |
parent | 153febce9ad827034f9aa70986f296c4292e6d0a (diff) | |
download | taskflow-0.13.0.tar.gz |
Merge "Add docstrings on runtime objects methods and link to them in docs"0.13.0
-rw-r--r-- | doc/source/engines.rst | 4 | ||||
-rw-r--r-- | taskflow/engines/action_engine/runtime.py | 23 |
2 files changed, 23 insertions, 4 deletions
diff --git a/doc/source/engines.rst b/doc/source/engines.rst index f119f50..2f162c8 100644 --- a/doc/source/engines.rst +++ b/doc/source/engines.rst @@ -237,7 +237,9 @@ saved to internal engine variables (these object help in execution of atoms, analyzing the graph and performing other internal engine activities). At the finishing of this stage a :py:class:`~taskflow.engines.action_engine.runtime.Runtime` object is created -which contains references to all needed runtime components. +which contains references to all needed runtime components and its +:py:func:`~taskflow.engines.action_engine.runtime.Runtime.compile` is called +to compile a cache of frequently used execution helper objects. Preparation ----------- diff --git a/taskflow/engines/action_engine/runtime.py b/taskflow/engines/action_engine/runtime.py index 061cca4..0439da1 100644 --- a/taskflow/engines/action_engine/runtime.py +++ b/taskflow/engines/action_engine/runtime.py @@ -44,9 +44,14 @@ class Runtime(object): self._atom_cache = {} def compile(self): - # Build out a cache of commonly used item that are associated - # with the contained atoms (by name), and are useful to have for - # quick lookup on... + """Compiles & caches frequently used execution helper objects. + + Build out a cache of commonly used item that are associated + with the contained atoms (by name), and are useful to have for + quick lookup on (for example, the change state handler function for + each atom, the scope walker object for each atom, the task or retry + specific scheduler and so-on). + """ change_state_handlers = { 'task': functools.partial(self.task_action.change_state, progress=0.0), @@ -152,6 +157,7 @@ class Runtime(object): # consumption... def reset_nodes(self, atoms, state=st.PENDING, intention=st.EXECUTE): + """Resets all the provided atoms to the given state and intention.""" tweaked = [] for atom in atoms: metadata = self._atom_cache[atom.name] @@ -165,13 +171,24 @@ class Runtime(object): return tweaked def reset_all(self, state=st.PENDING, intention=st.EXECUTE): + """Resets all atoms to the given state and intention.""" return self.reset_nodes(self.analyzer.iterate_all_nodes(), state=state, intention=intention) def reset_subgraph(self, atom, state=st.PENDING, intention=st.EXECUTE): + """Resets a atoms subgraph to the given state and intention. + + The subgraph is contained of all of the atoms successors. + """ return self.reset_nodes(self.analyzer.iterate_subgraph(atom), state=state, intention=intention) def retry_subflow(self, retry): + """Prepares a retrys + its subgraph for execution. + + This sets the retrys intention to ``EXECUTE`` and resets all of its + subgraph (its successors) to the ``PENDING`` state with an ``EXECUTE`` + intention. + """ self.storage.set_atom_intention(retry.name, st.EXECUTE) self.reset_subgraph(retry) |