Dsxir. RuntimeProgram. Executor
(dsxir v0.4.0)
Copy Markdown
Sequential topological DAG walk with skip cascading and an on_skip policy.
The executor is a pure function over a %Dsxir.RuntimeProgram{}, a host
%Dsxir.Program{}, and an inputs map. Per design, concurrency is deferred:
nodes execute in a single deterministic topological order produced by
Dsxir.RuntimeProgram.Topological.sort/2.
Per node:
- If any inbound
:requirededge originates from a previously-skipped node, this node is skipped and a[:dsxir, :runtime_program, :skipped]event is emitted withreason: :upstream_required_skipped. - Otherwise the (optional) guard predicate is evaluated against an env
built only from upstream-node outputs and the program inputs. A
{:ok, false}skips the node withreason: :guard_false. A runtime evaluator error raisesDsxir.Errors.Runtime.PredicateError. - Inputs are resolved from inbound edges. Edges whose source was skipped
and whose kind is
:optionalsubstituteniland mark the node's invocation asdegraded(forwarded toDsxir.Module.Runtime.call/4). - After all nodes run, program outputs are projected from the env. If
any output's chain was skipped, the
on_skippolicy decides whether to raiseDsxir.Errors.Runtime.SkippedOutputs, return{:partial, %Prediction{}}, or surface a%Prediction{}with nil-valued fields and a non-nil:skippedlist.
Iron Law: the executor is stateless aside from a local %ExecState{}
accumulator. Plain functions only — no GenServer, no Task.
Summary
Functions
Execute rp against host prog with inputs. See this module's
@moduledoc for the per-node algorithm and the on_skip policy.
Types
Functions
@spec execute(Dsxir.RuntimeProgram.t(), Dsxir.Program.t(), map(), keyword()) :: {Dsxir.Program.t(), Dsxir.Prediction.t()} | {Dsxir.Program.t(), {:partial, Dsxir.Prediction.t()}}
Execute rp against host prog with inputs. See this module's
@moduledoc for the per-node algorithm and the on_skip policy.
Supported opts:
:on_skip—:raise(default),:tagged_tuple, ornil.