Skip to main content

Module mapping

Module mapping 

Source
Expand description

Mapped tasks (decisions 69, 70, 74-79): which edges are lanes, the dimensions a mapped task’s instances span, an instance’s place in each, and the master’s resolution of what a task is mapped over.

  • A mapped task’s instances are the cartesian product of its mapped lists, the first argument written varying slowest (.expand_kwargs: one dimension, a list of dicts).
  • A lane is an element-wise data edge: the task is mapped over the whole output of a mapped upstream task, which it references nowhere else; instance i then waits only for that upstream’s instance i (70 B). Every other edge into a mapped task counts its upstream as a whole (70.1).

Structs§

Sources
What a mapped value is resolved against: the whole outputs of the tasks it references (a mapped task’s as the list of its instances’ outputs) and their outcomes (None: skipped).

Enums§

Dim
One dimension of a mapped task’s instances.
InputsError
Why a task instance’s inputs can’t be made.

Functions§

built_by_runner
Whether a value is left to its instance’s runner to build: it holds a template or a dag_ctx reference, which the master doesn’t render (decision 118), the run’s parameters included, or a secret, which the master never sees.
coordinates
Instance index’s place in each dimension of sizes (the first varying slowest).
count
The number of instances of sizes; None past usize.
dims
A mapped task’s dimensions, in order: each with the parameter it fills (None for .expand_kwargs, whose elements are dicts of arguments).
follow
path into a stored value (what of whose, for messages), as the runner reads it: a dict shaped like a tag is stored escaped ($dict, B66), a tuple as $tuple.
inputs
A task instance’s inputs, as JSON: the whole outputs of the upstream tasks it uses (not its lanes), and for an instance of a mapped task its own arguments under $expand, with the outcome of each taken from a lane under $expand_outcomes (decision 76), and those its runner builds in their stored form under $expand_values (decision 118). A lane reads its one upstream instance; a mapped list is resolved once per resolved.
is_lane
Whether edge is a lane: an element-wise data edge into a mapped task (70 B). An order edge, or a data edge whose upstream is used as a whole, counts its upstream as a whole.
is_mapped
Whether task is mapped (.expand(...)).
kind_of
A short description of json’s kind, for messages (“null”, “a string”).
lane_sources
The mapped upstream tasks task is mapped over element by element (its lanes): each the whole output of a mapped task, referenced nowhere else in task (a second reference, .partial(all=sizes) or sizes[0], makes it count as a whole: 70.1).
narrowed_whole
The mapped upstream task a dimension narrows element by element though it counts as a whole (used elsewhere in the task, so not a lane), with the outcomes taken: .partial(all=results).expand(rows=results.on(Rows)). Its instance whose upstream instance ended with another outcome, or was skipped, is skipped, as on a lane (decision 119).
narrows_per_element
Whether edge’s outcomes are taken per element (narrowed_whole), not on the whole upstream task, whose own outcome is only that its instances ended.
resolve
The stored JSON value stands for, as the runner would resolve it (None for a reference whose edge wasn’t taken). Errors say why a value can’t be resolved here.
resolve_mapped
What a mapped value stands for, as resolve, except that the elements of a list written in the file that its runners build (built_by_runner) are null here (in a dict, its entries the runners build): each reaches its instance in its stored form (decision 118), and the list’s length is known.
sources
The whole outputs and outcomes of tasks in a run, to resolve mapped values against: a mapped task’s output is the list of its instances’ outputs, in map_index order, null for one that didn’t succeed (decision 77). known gives an instance’s state when the caller knows it ahead of the database (a result being applied, its state not stored yet, B78): it is used instead of the stored one.

Type Aliases§

Resolved
Mapped lists already resolved, by (run, task, dimension): the instances of one task share them, so assigning N of them resolves each list once, not N times. Kept for one step.