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:

  1. If any inbound :required edge originates from a previously-skipped node, this node is skipped and a [:dsxir, :runtime_program, :skipped] event is emitted with reason: :upstream_required_skipped.
  2. 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 with reason: :guard_false. A runtime evaluator error raises Dsxir.Errors.Runtime.PredicateError.
  3. Inputs are resolved from inbound edges. Edges whose source was skipped and whose kind is :optional substitute nil and mark the node's invocation as degraded (forwarded to Dsxir.Module.Runtime.call/4).
  4. After all nodes run, program outputs are projected from the env. If any output's chain was skipped, the on_skip policy decides whether to raise Dsxir.Errors.Runtime.SkippedOutputs, return {:partial, %Prediction{}}, or surface a %Prediction{} with nil-valued fields and a non-nil :skipped list.

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

on_skip()

@type on_skip() :: :raise | :tagged_tuple | nil

Functions

execute(rp, prog, inputs, opts \\ [])

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, or nil.