Expand description
§nmbrs-workload
Contract & axioms: SRD 25.
Workload specification parsing and processing for nmbrs. Owns
the YAML schema definition (op templates, bindings, phases,
scenarios, tags, parameter inheritance) plus the inline
op='...' shorthand the CLI accepts in place of a workload
file.
The crate’s deliberately one-way: it parses YAML / inline
shorthand into a model::Workload tree and exposes helpers
to extract bind-points, tag-filter ops, and resolve template
parameters. It does not execute anything — that’s
nmbrs-runtime’s job.
§Pieces
model— the parsedWorkloadAST.Workload→WorkloadPhases + ops +ScenarioNodes; an op carries its field map plus parsed bindings.parse— YAML →Workload, with phase-name preservation and friendly error messages.inline—nmbrs run op='hello {{cycle}}'synthesizer: builds a one-opWorkloadfrom a single CLI string.bindpoints— extracts{name},{{expr}}, qualified refs ({coord:cycle},{capture:foo}) from any string.tags—tags=block:main,phase:readfilters during op selection.template—{param}template substitution with default-value support.
§Quick examples
Bind-point extraction:
use nmbrs_workload::bindpoints::{extract_bind_points, BindPoint, BindQualifier};
let pts = extract_bind_points("INSERT INTO t VALUES ({id}, {{hash(cycle)}})");
assert_eq!(pts.len(), 2);
assert!(matches!(
&pts[0],
BindPoint::Reference { name, qualifier: BindQualifier::None, .. } if name == "id",
));
assert!(matches!(&pts[1], BindPoint::InlineDefinition(expr) if expr == "hash(cycle)"));Template substitution at workload-build time:
use nmbrs_workload::template::expand_templates;
use std::collections::HashMap;
let mut params = HashMap::new();
params.insert("table".into(), "users".into());
let resolved = expand_templates(
"SELECT * FROM TEMPLATE(table,defaultvalue)",
¶ms,
);
assert_eq!(resolved, "SELECT * FROM users");§See also
- SRD 20 (
docs/SRD/20_workload_model.md) — workload model - SRD 21 (
docs/SRD/21_parameters.md) — parameter resolution precedence - SRD 18 (
docs/SRD/18_control_flow.md) — scenario-tree constructs (for_each,do_while,do_until,for_combinations)
Modules§
- bindpoints
- Bind point detection and field classification.
- catalog
- SRD-85 bundled-workload catalog (embedded workloads, tiers, exact-name lookup). Bundled-workload catalog — SRD-85.
- construction
- Enumerable workload-construction nodes.
- drivers
- SRD-109 driver manifests (
driver=<name>→ adapter + library - edit
- Workload-edit primitive — SRD-64 §6.4–§6.5.
- extends
- Workload
extends:resolution and merging (SRD-72). - implements
- SRD-108 Part B — the typed implementation binder.
- inline
- Inline workload synthesis from the
op=command-line parameter. - magnitude
- Magnitude-suffix-aware numeric coercion for workload parameters.
- metric_
format - SRD-40b §1 generation-time numeric sanitiser for synthetic
metrics. Parses Excel-style hash-pattern format strings
(
#.##,0.000) into aFormatSpecthat theMetricsDispenserwrapper consults at registration time to derive a round operation applied before each cycle’s value is recorded on the instrument. - model
- Normalized workload model: the canonical ParsedOp representation.
- op_
templates - Op templates: reusable op definitions an op instantiates with
uses:. - parse
- YAML workload parser and normalizer.
- polydat_
matter - SRD-13d §3.1 — declarative GK-content classification for
every node in the workload AST. The scope-tree pre-walker
uses
HasPolydatMatter::polydat_matteras the first question at every scope decision: most workloads short-circuit here and never reach the program-hash-equivalence refinement (§3.2). - report
- Unified
report:block — plots and tables under one schema. - report_
synth - SRD-109 — report synthesis: the workload’s structure IS the report definition.
- spectest
- SpecTest: parse and validate workload specification examples.
- suggest
- SRD-85 deep workload suggestions — the shared “did you mean” set over the local file hierarchy and the bundled catalog, used by completion and the resolver not-found paths. Deep workload suggestions — the shared “did you mean” set.
- tags
- Tag-based op template filtering.
- template
- TEMPLATE macro expansion.
- verify
- Workload verification — run a workload and check its output against rules
embedded in the workload file. Shared by the
nmbrs checksubcommand and the example-walker test, so “how CI checks the examples” and “how a user checks their own workload” are the same code. - vocab
- Flat name projections of the workload-construction registry.