Skip to main content

Module runner

Module runner 

Source
Expand description

Shared run pipeline for persona binaries.

Encapsulates workload parsing → Polydat compilation → activity construction → execution (single or phased).

Each persona binary links its adapter crates (which register themselves via inventory::submit!) and calls run(). The persona adds nothing but adapters and node functions — all orchestration logic lives here.

Structs§

DiagnosticConfig
Diagnostic configuration parsed from dryrun= parameter.
ExecutionSpec
SRD-88 — one execution’s spec for run_executions: the workload CLI args, the observer that captures its lifecycle/log, and an optional per-execution output channel (SRD-87 buckets). channel = None falls back to the process-global channel; in-process example verification passes a CaptureChannel so each execution’s op stdout is captured separately.
ManifestEntry
One entry in a program’s output manifest: typed, modifier- aware view of a single output name.

Enums§

ExecDepth
Run a workload. Adapters are discovered from link-time inventory registrations — the calling binary just needs to link the adapter crates it wants available. Execution depth: how far through the pipeline to go.
ResolvedWorkload
Resolve a workload file path from a bare name. Tries: as-is, with .yaml/.yml extension, then under workloads/. SRD-85 resolution result: a local file path or a bundled catalog entry.

Constants§

DEFERRED_STDOUT_FILE
Session-dir file holding end-of-run summary output that is routed to stdout (SRD-46 to stdout) but could not be written inline because a TUI owned the terminal. The post-run printer flushes it verbatim once the terminal is back in cooked mode.
SESSION_PARAMS
Param keys that configure the session-tier services — one value per session, shared by every execution under it. Executions that declare different values for any of these cannot share a session; a multi- execution harness must group by them and set up one session per group (see session_param_signature). metrics_cadence is the load-bearing case: it fixes the cadence the optimizer settle detector samples, so workloads wanting a sub-second cadence must run in their own session.

Functions§

collect_repeated_flag
Collect every occurrence of a repeatable flag (e.g. --trace=<spec> or trace=<spec>) from a raw arg list. Returns the values in order of appearance — parse_params collapses repeats into a HashMap, so this is the escape hatch for repeatable args.
create_adapter
Create an adapter from inventory registrations.
detect_conflicting_duplicate_params
Reject a key=value run param supplied more than once with conflicting values. These params collapse into a map (last value wins — see parse_params), which silently discards an earlier value: e.g. scenario=reset scenario=idx_sweep drops reset and runs idx_sweep. A repeat with an IDENTICAL value is harmless and allowed (re-passing the same value shouldn’t break a script); a conflicting repeat is an ambiguous instruction, so it’s rejected and surfaced rather than silently last-wins (“Never Ignore Silently”).
effective_params
The run’s effective parameters: the workload’s declared top-level params: (extends-merged) as the base, with CLI key=value args overlaid on top (CLI wins). This is the single consolidated param set — the same one whether a setting is declared in the workload or passed on the command line — used for session-tier services (metrics cadence, push reporters, per-instance metrics) and console-ownership detection alike. The per-execution path reaches the same result by overlaying CLI onto the fully-parsed workload.params (see run_execution).
expand_workload_params
Expand {key} workload param placeholders in a string.
extract_manifest
Extract the output manifest from a compiled Polydat program. Returns one entry per output, in declaration order.
install_known_flags
Install the run-style flag vocabulary (long forms + aliases from the CLI command-spec, split by arity). Idempotent — first wins.
install_known_params
Install the run-style param vocabulary (the keys the CLI command-spec accepts, sans the trailing =). Called once at binary startup from the CLI layer, which owns the canonical list. Idempotent — first wins.
normalize_args
Normalize args: detect scenario shorthand where a bare word after the workload file becomes scenario=<name>.
parse_count
Parse a cycle count that may have suffixes: K, M, B.
parse_log_level
Parse a CLI/workload loglevel= value. Case-insensitive, accepts the standard names plus the abbreviations the log sink emits (DBG / INF / WRN / ERR).
parse_params
Parse key=value pairs from command line args.
render_controls_tree
Walk a component subtree and print every declared control (name, type, current value, scope, final flag, applier count) in a stable order. Used by dryrun=controls and any other discovery-style call site.
render_scope_elision_summary
Render the SRD-13d scope-elision summary for dryrun=op. One line per scope-tree node (DFS pre-order), showing the logical name and the materialised/elides-to mark.
report_config_from_summary
Convert the workload-model SummaryConfig (parsed from the summary: workload field or the --summary CLI flag) into the SQLite reporter’s ReportConfig. Used by both the in-run summary path (workload finished, render to summary.md) and the standalone nmbrs --summary command, so both produce identical output for the same spec.
resolve_workload
Resolve a workload= value per SRD-85 nearest-first: local files first (exact path, extension probing, cwd workloads/), then the bundled catalog by exact name. A name that resolves both ways FAVORS the logical filesystem location and logs a warning naming both — shadowing is allowed but never silent. ./-prefixed paths pin the local reading without a warning.
resolve_workload_file_public
Try to resolve a workload name (bare or with extension) to an actual file path, searching the current directory and ./workloads/. Returns None if nothing matches.
run
run_activity_simple
run_executions
SRD-88 — run N executions CONCURRENTLY in one process, all sharing ONE session, at most max_concurrent in flight. The session (SessionHost: dir / stores / cadence + scheduler services) is set up ONCE and torn down ONCE, after every execution. Each execution loads + runs its own workload, derives its own Execution (distinct allocated exec_id) under the shared session component, flushes its metrics into the shared store via CadenceReporter::quiesce without tearing the reporter down, and routes its lifecycle/log through its own observer (a scoped [ExecutionContext]). Results come back in input order.
run_with_observer
Run with a custom observer for phase lifecycle events. The TUI persona uses this to inject a TuiObserver that updates the display state instead of printing to stderr.
scenarios_in_workload_file
List the scenario names declared at the top level of a workload YAML file. Used by shell-completion tooling to offer scenario=<tab> suggestions. Returns an empty vector on any parse error — completion is best-effort, not a hard check.
session_param_signature
The session-grouping signature for a workload reference: its declared values (following extends:) for the SESSION_PARAMS, sorted. Workloads with equal signatures can share one session; differing ones must not. Empty signature = “the default session is fine”.