An abstract program runtime for ASTs produced by ablauf.job.ast
.
This exposes two functions for the outside world: make
and restart
You are expected to create a program to be ran with the functions
available in the ablauf.job.ast
namespace. This program is then
initialized with the rough equivalent of an instruction pointer and
a context.
This namespace makes no guess as to how program instructions are actually performed, instead, for each position of the program, it yields the instructions to carry out. There might be more than one if parallelism is used.
The logical flow is thus:
For an actual full fledged program runner, a runner using
manifold as the underlying dispatching engine is provided
in ablauf.job.manifold
, an SQL backed one in ablauf.job.sql
.
An abstract program runtime for ASTs produced by `ablauf.job.ast`. This exposes two functions for the outside world: `make` and `restart` You are expected to create a *program* to be ran with the functions available in the `ablauf.job.ast` namespace. This program is then initialized with the rough equivalent of an instruction pointer and a context. This namespace makes no guess as to how program instructions are actually performed, instead, for each position of the program, it yields the instructions to carry out. There might be more than one if parallelism is used. The logical flow is thus: - call restart on a program with an empty result list - carry out resulting actions - call restart on the result of the actions For an actual full fledged program runner, a runner using **manifold** as the underlying dispatching engine is provided in `ablauf.job.manifold`, an SQL backed one in `ablauf.job.sql`.
(abort job)
(abort job reason)
Given a job, mark pending all pending leafs as failure with the proper reason. Yields an updated job.
Given a job, mark pending all pending leafs as failure with the proper reason. Yields an updated job.
(ast-zip ast)
Given a well-formed AST (as per ablauf.job.ast
), yield a zipper
Given a well-formed AST (as per `ablauf.job.ast`), yield a zipper
(augment context {:ast/keys [augment] :exec/keys [result output]})
When an AST node contains an augment
key, process it to
augment the resulting context. Augments have a source:
a function of the output, a keyword or vector, of keyword
pointing to a path in the output. Augments also have a destination
a key or key vector of the position in which to augment the context.
When an AST node contains an `augment` key, process it to augment the resulting context. Augments have a source: a function of the output, a keyword or vector, of keyword pointing to a path in the output. Augments also have a destination a key or key vector of the position in which to augment the context.
(augmentable? {:ast/keys [augment] :as node})
Predicate to test for an augmentable node
Predicate to test for an augmentable node
(done? job)
Predicate to test for completion of a (sub)job Here is the per-status breakdown:
status | done? |
---|---|
:job/failure | Y |
:job/success | Y |
:job/pending | N |
Predicate to test for completion of a (sub)job Here is the per-status breakdown: | status | `done?` | |--------|---------| | `:job/failure` | Y | | `:job/success` | Y | | `:job/pending` | N |
(eligible? job)
Predicate to test for pending completion of a (sub)job. Here is the per-status breakdown:
status | eligible? |
---|---|
:job/failure | N |
:job/success | N |
:job/pending | Y |
Predicate to test for pending completion of a (sub)job. Here is the per-status breakdown: | status | `eligible?` | |--------|---------| | `:job/failure` | N | | `:job/success` | N | | `:job/pending` | Y |
(failed? job)
Predicate to test for failure of a (sub)job Here is the per-status breakdown:
status | failed? |
---|---|
:job/failure | Y |
:job/success | N |
:job/pending | N |
Predicate to test for failure of a (sub)job Here is the per-status breakdown: | status | `failed?` | |--------|---------| | `:job/failure` | Y | | `:job/success` | N | | `:job/pending` | N |
(index-ast pos)
Uniquely identifies job nodes, for later merging
Uniquely identifies job nodes, for later merging
(make ast)
Creates a job, suitable for restart
from a valid AST as
produced by functions in ablauf.job.ast
Creates a job, suitable for `restart` from a valid AST as produced by functions in `ablauf.job.ast`
(make-with-context ast context)
Creates a job, attaching an initial context map, as for make
,
this creates a tuple suitable for restart
Creates a job, attaching an initial context map, as for `make`, this creates a tuple suitable for `restart`
(merge-results job context nodes)
Updates a job given a list of node updates. Node updates either come from an action dispatch return, or from newly found dispatchs.
Updates a job given a list of node updates. Node updates either come from an action dispatch return, or from newly found dispatchs.
(pending? job)
Predicate to test for pending completion of a (sub)job Here is the per-status breakdown:
status | pending? |
---|---|
:job/failure | N |
:job/success | N |
:job/pending | Y |
Predicate to test for pending completion of a (sub)job Here is the per-status breakdown: | status | `pending?` | |--------|---------| | `:job/failure` | N | | `:job/success` | N | | `:job/pending` | Y |
(prepare-replay job)
It will traverse the whole job and:
Yields the modified job
It will traverse the whole job and: 1. mark as unstarted all (pending or failed) idempotent leafs 2. mark as failure all pending non idempotent leafs Yields the modified job
(prune ast)
Remove empties :ast/nodes leaves
Remove empties :ast/nodes leaves
(reload ast context)
Yield a job ready for restart from a data ast and an optional context.
Yield a job ready for restart from a data ast and an optional context.
(remove-nodes-by job f)
Removes any node that returns true for (f node)
. Can be a leaf or not.
Removes any node that returns true for `(f node)`. Can be a leaf or not.
(restart [job context] results)
Given a job, and node updates for it, figure out the next course of action to take.
Yields an updated job and potential side-effects. The result has the following structure:
[job context dispatchs]
This allows using the return of restart
as an accumulator
for reductions
or similar functions.
Given a job, and node updates for it, figure out the next course of action to take. Yields an updated job and potential side-effects. The result has the following structure: [job context dispatchs] This allows using the return of `restart` as an accumulator for `reductions` or similar functions.
(status ast)
Get the job status from an ast.
Status predicates breakdown:
| status | done?
| failed?
| eligible?
| pending?
|
|--------|---------|-----------|-------------|------------|
| :job/failure
| Y | Y | N | N |
| :job/success
| Y | N | N | N |
| :job/pending
| N | N | Y | Y |
Get the job status from an ast. Status predicates breakdown: | status | `done?` | `failed?` | `eligible?` | `pending?` | |--------|---------|-----------|-------------|------------| | `:job/failure` | Y | Y | N | N | | `:job/success` | Y | N | N | N | | `:job/pending` | N | N | Y | Y |
(unzip zipper)
Get back to a data AST from a program's zipper
Get back to a data AST from a program's zipper
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close