Dmn.Execution (dmn v0.1.0)

Copy Markdown View Source

The preflight of a DMN call: what Dmn.evaluate/4, evaluate_all/4, invoke/4 and run/2 copy into their worker. Internal: not a supported API.

prepare/6 runs in the caller before the worker starts, under the budget and deadline of Feel.Worker.Preflight (the internal run_prepared entry point of Feel.Worker). It resolves the requested names, orders the units they need with the planner of Dmn.Compiled, keeps those units in the compact form a worker needs (executable, reads, groups, faults and options, not the source text, syntax tree, IR or diagnostics), keeps every input key and the values the decision reads, and decides whether the source maps of the other units must travel too. It returns the closure that the worker runs; anything it cannot decide within its budget makes it return the original, complete request instead, so a fallback costs time and skips no check.

The source maps of other units travel only when a run could report a diagnostic whose origin is another unit: a function supplied by the caller, a custom calendar, an extension that is not declared data only (Dmn.Compiled.feel_data_only, recorded at compilation), or a unit whose expression holds such a thing. callback_free?/1 answers the last once, at compilation, for what a worker is given of an expression (Dmn.Compiler.Unit.callback_free); a unit without the answer is inspected here. No extension code is called here.

See the preflight and DD-44 in the decisions of dmn.

Summary

Functions

prepare(compiled, names, inputs, options, operation, context)

@spec prepare(Dmn.Compiled.t(), list(), term(), keyword(), :evaluate | :invoke, map()) ::
  (-> term()) | {:error, :timeout}