Package: schema#

The shapes that HydroModPy writes for a reader outside this process. One family is for a front end, the JSON Schema of the whole configuration and the sentence of each code that a check gives. The other is for an orchestrator, the job directory that a capability writes and the declaration of each capability. The package reads core and itself, so a document can be described without importing any science.

seal.py holds the one seal of a run and of a job, at manifest_version 4 with a profile, and lineage.py holds the block that both profiles carry. changes.toml is the register of the numbers, defaults and keys that move, and phrases.toml gives the sentence of each check code, label value, label reason, check state and line of the method text of a run, in English and in French. phrases.py is its one reader.

job/ has the job directory, processes/ the generated description of each capability and results/ the published JSON Schemas of the stored formats.

The page of the package in the developer docs lists the modules with the first line of their docstring and tells how the folders fit together.

Modules#

top level

Module

What it does

Lines

capability.py

What a capability declares about itself, before any of it runs.

248

changes.py

The register of changes, changes.toml, read once and checked.

556

config_schema.py

JSON Schema export of the HydroModPy configuration.

887

generated_views.py

The file names a generated view takes inside a run or a job directory.

47

lineage.py

The lineage block of a seal: where a run comes from, by ids.

152

media_types.py

The media types a job document names, spelled once.

42

phrases.py

The one reader of phrases.toml: the sentence of a code, in English and in French.

50

seal.py

The one seal of a run and of a job: what a finished directory promises.

209

sources.py

The licence and the facts of each data source this build reads, stated once.

1 069

job/

Module

What it does

Lines

directory.py

The one directory a capability process is allowed to touch.

218

documents.py

How a job writes one of its documents: whole, or not at all.

78

extent.py

The spatial extent a job records: one box, in the CRS it was measured in.

85

inputset.py

What a job consumed, as one object: resolved, hashed, licence-annotated.

264

layout.py

The names inside a job directory, and the order they are written in.

102

outcome.py

The typed outcome of one job: status, exit code, timing, errors.

307

provenance.py

How one job ran: tool, commit, interpreter, platform, backend, packages.

154

refusal.py

How this boundary refuses one member of a request document.

44

request.py

The input document, read and refused in one typed shape.

227

reuse.py

A directory that already holds the same job is re-reported, never re-run.

129

seal.py

The seal: written last, atomically, and never on a job that did not finish.

330

worker.py

The loop every capability worker runs around its own work.

187

Inside the package#

results/record/manifest.py extends the seal of seal.py for a run, because the blocks of a run are types of results and schema has no edge towards it. The same rule shapes the two folders of published files. processes/ and results/ hold package data, and their __init__.py reads and writes the files and imports no model. The caller pairs a file with its model.

The job directory is the whole interface between a caller and a capability, and nothing in job/ opens a database, a socket or a workspace. manifest.json is the seal of a finished job, at manifest_version 4 and profile = "job", the common model of seal.py. It carries request_id, the content address of the request, and outcome.json keeps that value under its field job_id. read_job_seal also reads the older hmp-manifest/v2 family, in memory, without rewriting the file. The caller creates the directory and writes request.json. The process writes outputs/, inputset.json, provenance.json, outcome.json and manifest.json, in that order, so the seal exists if and only if the job succeeded. A capability is added as a CapabilityDecl and a worker beside the code.

The files of processes/ are generated. python -m tools.processes writes index.json and one <id>@<major>.json per capability from its CapabilityDecl, and a test refuses a committed file that the declaration no longer reproduces.

The files of results/ are the JSON Schemas of the stored formats, one <name>.<version>.json per document that a run, a session, a plan or a publication writes, and the one that hmp calibrate --format json prints. A reader outside Python validates a document against them without importing anything. They are generated from the Pydantic models with model_json_schema(), and tests/unit/schema/test_results_schemas_match_models.py refuses a committed file that its model no longer reproduces. Run as a script, it writes them again. The plan is plan.v2.json, because a plan keeps its cases in cases.csv.