Skip to content

Add partial run instructions and parameters for scalability #20

Description

@jaakla

Scope note (after review in this comment).
This issue is now scoped to workstream (a): the deterministic, CLI-testable half — sampled run execution, marking, non-promotion, and eval coverage.
The rest was split out: #22 (skill guidance and correctness traps), #23 (cost estimation and escalation ladder), #24 (federated divide-run-combine execution).
The original problem statement is preserved in full at the bottom.

Scope: sampled runs that can never be mistaken for canonical ones

1. CLI surface

--dry-run is already taken on openmapstack run and means "validate preflight and print the command without executing it" (openmapstack/cli.py:49, documented in README.md:173). Sampled execution needs its own flags:

openmapstack run project.yaml --sample                  # sample per the manifest's declared sampling parameter
openmapstack run project.yaml --sample-area <bbox>      # explicit test AOI
openmapstack run project.yaml --sample-rows <n>         # explicit row cap
openmapstack run project.yaml --sample-fraction <pct>   # explicit fraction

A single --sampling-size 1% is ambiguous — percent of area, of rows, or of raster resolution are three different knobs with three different failure modes — so they are separate flags. The run record stores the realized sample (actual rows, actual AOI, actual resolution), not just the requested one: TABLESAMPLE and friends only approximate.

2. Where the parameter is declared

Start with the existing runtime.implementation.parameters contract (openmapstack-parameters/v1), which already models "same pipeline, one knob turned" and already carries the rule that the canonical run passes nothing. No schema change, determinism preserved, and verify's project.parameters_match_steps honesty check comes along for free.

Open question to settle during implementation: today step/field bind a parameter to a processing step, while a sample AOI is a source selection knob — decide whether sources.*.selection.bbox can be a legal field target, or whether sampling parameters are exempt from the step/field pairing.

Promote sampling to a first-class sampling: manifest block only if evals show agents cannot use the parameter contract reliably.

3. The hard constraint: non-promotion

A sampled run legitimately produces a different inputs_hash — clipped or downsampled sources are different bytes — so it cannot share the canonical run's hash chain. It must therefore be structurally incapable of becoming the accepted result:

  • the run record carries an explicit mode: sampled (default canonical), plus the realized sample descriptor and per-step timings (the latter is what Non-interactive cost estimation and the scale escalation ladder #23 consumes);
  • a sampled run never occupies runs.latest — otherwise verify and the clean-rerun protocol inherit a fake baseline;
  • a sampled run can never set project.status: validated, even when every check passes (references/project-spec.md:341);
  • validation.expectations can never be satisfied from sampled output;
  • validate / verify reject a sampled run offered as evidence, with a clear message rather than a hash mismatch;
  • the report and dashboard label it, in the spirit of the existing status: draft_unvalidated override-bundle precedent (references/project-spec.md:614).

4. Eval coverage

908-validation-laundering already exists, and "sampled run presented as a validated result" is exactly that failure class. Per AGENTS.md both paths must be proven:

  • a healthy fixture case: a sampled run executes, is marked, does not take runs.latest, and does not promote status;
  • a negative case (e.g. 922-sampled-run-as-canonical) that must fail — a manifest presenting a sampled run as the validated answer.

Acceptance criteria

  • Sampled runs are executable from the CLI without redefining --dry-run.
  • The realized sample, not just the requested one, is recorded.
  • No code path allows a sampled run to set runs.latest or project.status: validated.
  • validate/verify reject sampled evidence with an intelligible error.
  • Healthy fixture case and negative case both present and both proving what they claim.
  • README/project-spec.md updated only where the public contract actually changed.

Out of scope (deliberately)

Choosing a sensible AOI automatically. That needs populated-place data the CLI does not have and should not grow, and it has no deterministic oracle to test against — it is judgment, and it lives in #22.


Original issue text

Problem

Full project runs with all the needed geographic data, especially with wide areas, high resolutions and processing complexity can take long time - not only minutes, but also hours and days. Also they consume extra compute resources (CPU, storage, RAM). It can easily happen that only in later phase some workflow step fails, and full processing needs to be redone.

Solution

Use "nail it before you scale it" concept - at least with automated flows run first test with limited samples, as a "dry run". It is not really dry, more like moist run. There are several sampling strategies depending on data and case: as default use smaller sub-area as test AOI (primary one - ensures that filtered in geometries do match together), also if this is not enough (or possible) then limit queries from big tables to certain number of first items (can use postgres tablesample SQL or similar), pre-process test data to reduce resolution of rasters and elevations, use pre-simplified geometries for complex polygons/polylines etc.

Add parameters to the run command:

  • as general limiter (eg --sampled or --dry-run). Without extra hints it tries to estimate sampling agressiveness from the problem and if available metadata of sources what is reasonable sampling % and choose good sample within original AOI. The area cannot be totally random, e.g. for global map data it may be easily in blue ocean, instead of useful populated place; in some cases the good sample is city, but sometimes exactly outside city; in some cases it may really be inside ocean.
  • optional parameters may give explicit limiting quantity, e.g. "--sampling-size 1%"
  • for well-controlled cases allow setting test AOI explicitly: --sampling-area

Add to the skill instructions specific prose to use extensively these sampled pre-runs.

Acceptance criteria

  • Bigger analyses get drier pre-run with reasonable sample, which is audited (but also clearly marked) as a real run. Only small analyses within <10 min processing time can skip it.
  • Very big analyses (taking hours, days and more) try to estimate final runtime and ask user for confirmation if so big job gets accepted. Allow to choose also partial next level test options, e.g. before world-wide analysis offer to run it in city (probably the first test run) , county, small country, big country and/or continent levels.
  • for very big cases offer also suggestions how to run it faster with more parallel processing - splitting job between task runners / nodes somehow, and offer implementation of such federated (divide-run-combine, map-reduce) approach.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions