Metadata-Version: 2.5
Name: trytond_score_dag
Version: 8.0.0.1
Summary: Score Workflow Engine — Composition and Iteration
Author: Clemens Hupka
Maintainer-email: Clemens Hupka <clemens.hupka@backend.at>
License-Expression: GPL-3.0-or-later
License-File: COPYRIGHT
License-File: LICENSE
Keywords: engine,loop,score,sub-workflow,tryton,workflow
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Environment :: Plugins
Classifier: Framework :: Tryton
Classifier: Topic :: Office/Business
Requires-Python: >=3.10
Requires-Dist: trytond-company<8.1,>=8.0
Requires-Dist: trytond-score<8.1,>=8.0
Requires-Dist: trytond<8.1,>=8.0
Provides-Extra: test
Description-Content-Type: text/x-rst

Score DAG Module
================

The ``score_dag`` module extends the ``score`` workflow engine with
composition and iteration.  A definition may call another workflow as a
sub-workflow and may loop over a part of its machine a bounded number of
times.

A sub-workflow is a state of the parent machine that starts a child
``score.instance``.  The child runs on the record the parent drives or on
a record the parent points to, its context is filled from an explicit
mapping of the parent context, and the parent waits - its token is parked
- until the child reaches a final state.  The child result, its final
state code included, is then propagated back into the parent context and
the parent continues on the transition whose guards the result satisfies.

A loop is a pair of states: a loop start, which declares the maximum
number of iterations and the PYSON continuation condition of the loop,
and a loop end, which the transitions of the loop body lead back to.  The
iteration counter lives on the token of the instance and the loop is
entered with it, so the number of iterations a run may perform is bounded
by the definition rather than by the goodwill of its author: the bound is
mandatory, and the back edge of a loop that reached it is refused.

Both constructs are validated when a definition is published rather than
when it runs.  A sub-workflow whose target workflow is missing or is not
published, a loop without a bound, a loop pair whose ends do not name one
another, and a machine whose cycles are not the declared loops are all
refused before a revision is frozen, with a message naming the state that
must be corrected.

The full trace of a run is reconstructible: every instance knows the
instance that started it and the root it belongs to, so the descendants
of a root and their transitions are read in order, and the history of a
tree names the definition each of its runs executed.
