hmp catalog#

Uses hmp.trash().

$ hmp catalog [-h] <action> ...

Maintain the index of a project and its runs

CommandWhat it does
hmp catalog queryRun a SQL statement against the project index
hmp catalog gcMaintenance: measure the project, close dead attempts, trash old versions, purge fields
hmp catalog reindexBuild the project index from what the run and session directories declare
hmp catalog deleteMove a run or a session to the trash (reversible); --now to remove it for good
hmp catalog restoreMove a trashed run or session back to the directory it came from
hmp catalog trashMove a run to the trash, list the trash, or remove its entries with --empty
hmp catalog tagAdd or remove tags on a run (reserved tag: pinned, kept out of trash and gc)
hmp catalog noteAppend a timestamped note to a run
hmp catalog renameRename a run: runs/<old>/ and sessions/<old>/ move to the new name
hmp catalog watchShow the running attempts with the age of their heartbeat
hmp catalog importImport a run written by 'hmp publish' (directory or tar), with the data it read
hmp catalog rerunLaunch a run again from its frozen config.toml, with --set path=value overrides

hmp catalog query#

$ hmp catalog query [-h] [-w WORKSPACE] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--limit LIMIT] sql

Open the index read-only and run one statement. The tables are those of the index (simulations, cases, attempts, sites, parameters, metrics, calibration_sessions ...) and its views (v_cases, v_simulation_summary).

ArgumentWhat it does
sqlSQL statement to execute against the index
--limit LIMITWrap the SQL in a LIMIT clause to cap the result set

Also takes the shared options --workspace --format --verbosity --quiet --verbose --debug.

Example

$ hmp catalog query "SELECT case_id, label, nse FROM v_cases" --format json

Exit codes it sets itself: 1 10. All exit codes.

hmp catalog gc#

$ hmp catalog gc [-h] [-w WORKSPACE] [-y] [--dry-run] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--keep-versions N|all] [--max-age-days DAYS] [--trial-fields-days DAYS|never] [--solver-files-days DAYS]

Maintenance: measure the project, close dead attempts, trash old versions, purge fields

ArgumentWhat it does
-y, --yesCarry the plan out. Without it the verb prints the plan and changes nothing
--keep-versions N|allVersions kept per run name; older ones go to the trash (default: 5, 'all' disables the rule)
--max-age-days DAYSAlso trash runs started more than DAYS ago (default: no age limit)
--trial-fields-days DAYS|neverRemove the fields of kept trials older than DAYS, all but the best (default: 90, 'never' disables the rule)
--solver-files-days DAYSRemove the solver/ folder that keep_solver_files kept in sealed runs older than DAYS (default: never, the folders stay)

Also takes the shared options --workspace --dry-run --format --verbosity --quiet --verbose --debug.

A directory tagged 'pinned' is never collected. Trash entries are removed 30 days after their deletion. The fields of a kept trial leave after 90 days, all but the best.

Examples

$ hmp catalog gc
$ hmp catalog gc --dry-run --format json
$ hmp catalog gc --keep-versions 3 --max-age-days 180 -y
$ hmp catalog gc --trial-fields-days never -y
$ hmp catalog gc --solver-files-days 30 -y

Exit codes it sets itself: 10. All exit codes.

hmp catalog reindex#

$ hmp catalog reindex [-h] [-w WORKSPACE] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--incremental]

Read every directory under runs/ and sessions/ and write .hmp/index.duckdb from them: the sealed runs with their label of the day, the attempts that failed or are running, the calibration sessions with their trials. The index is written to a staging file and published in one atomic step, so a reader keeps reading until the new one is there, and building twice yields the same index. With --incremental only the directories that appeared, changed or disappeared since the last pass are written.

ArgumentWhat it does
--incrementalWrite only what changed since the last pass; a full rebuild otherwise

Also takes the shared options --workspace --format --verbosity --quiet --verbose --debug.

Examples

$ hmp catalog reindex
$ hmp catalog reindex --incremental

hmp catalog delete#

$ hmp catalog delete [-h] [-w WORKSPACE] [-y] [--dry-run] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--site SITE] [--now] [--force] SIM_REF

Move a run or a session to the trash (reversible); --now to remove it for good

ArgumentWhat it does
SIM_REFFull sim_id, unique hex prefix, name, or an @-selector (@last, @best:METRIC, @worst:METRIC, @running)
--nowRemove the directory for good: a tombstone keeps its name from being reused
--forceGo past the pin and the stale attempt: act on a pinned directory, or on one whose attempt stopped beating

Also takes the shared options --workspace --yes --dry-run --format --verbosity --quiet --verbose --debug --site.

The reference is the directory: a bare name is runs/<name> exactly, and a bare name whose stem has other versions is refused with the list.

Examples

$ hmp catalog delete baseline_v2 -y
$ hmp catalog delete sessions/calibration -y
$ hmp catalog delete baseline_daily --now -y

Exit codes it sets itself: 2 130. All exit codes.

hmp catalog restore#

$ hmp catalog restore [-h] [-w WORKSPACE] [--dry-run] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] SIM_REF

Move a trashed run or session back to the directory it came from

ArgumentWhat it does
SIM_REFThe name 'hmp catalog trash' lists, or the directory the entry came from (baseline_daily, sessions/calibration)

Also takes the shared options --workspace --dry-run --format --verbosity --quiet --verbose --debug.

Examples

$ hmp catalog restore baseline_daily
$ hmp catalog restore runs__baseline_daily@20261014T093000

hmp catalog trash#

$ hmp catalog trash [-h] [-w WORKSPACE] [-y] [--dry-run] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--empty] [--force] [REF]

Move a run to the trash, list the trash, or remove its entries with --empty

ArgumentWhat it does
REFMove this run or session to trash/. Without it, list the trash.
--emptyRemove every trashed directory for good (frees disk, leaves tombstones)
--forceGo past the pin: remove the pinned directories too when emptying

Also takes the shared options --workspace --yes --dry-run --format --verbosity --quiet --verbose --debug.

Each removed entry leaves a line in trash/tombstones.txt, so its name is never given to a new run.

Examples

$ hmp catalog trash
$ hmp catalog trash --empty --dry-run
$ hmp catalog trash --empty --force -y

Exit codes it sets itself: 2 130. All exit codes.

hmp catalog tag#

$ hmp catalog tag [-h] [-w WORKSPACE] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--site SITE] [--rm TAG] SIM_REF [TAG ...]

Add or remove tags on a run (reserved tag: pinned, kept out of trash and gc)

ArgumentWhat it does
SIM_REFFull sim_id, unique hex prefix, name, or an @-selector (@last, @best:METRIC, @worst:METRIC, @running)
TAGTags to add (a leading + is optional)
--rm TAGTag to remove (repeatable)

Also takes the shared options --workspace --format --verbosity --quiet --verbose --debug --site.

Example

$ hmp catalog tag baseline_v2 pinned paper --rm draft

Exit codes it sets itself: 2. All exit codes.

hmp catalog note#

$ hmp catalog note [-h] [-w WORKSPACE] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--site SITE] SIM_REF text

Append a timestamped note to a run

ArgumentWhat it does
SIM_REFFull sim_id, unique hex prefix, name, or an @-selector (@last, @best:METRIC, @worst:METRIC, @running)
textNote text

Also takes the shared options --workspace --format --verbosity --quiet --verbose --debug --site.

Example

$ hmp catalog note calibration "best fit after widening Sy bounds"

hmp catalog rename#

$ hmp catalog rename [-h] [-w WORKSPACE] [--dry-run] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--site SITE] SIM_REF new_name

Rename a run: runs/<old>/ and sessions/<old>/ move to the new name

ArgumentWhat it does
SIM_REFFull sim_id, unique hex prefix, name, or an @-selector (@last, @best:METRIC, @worst:METRIC, @running)
new_nameNew directory name

Also takes the shared options --workspace --dry-run --format --verbosity --quiet --verbose --debug --site.

The directory is the name, so a rename moves runs/<old>/ and, for a calibration, sessions/<old>/ to the new name. Links between them are ids and stay valid. The new name must be free: a live directory, a trashed one or a tombstone holding it is refused.

Example

$ hmp catalog rename baseline_v2 baseline_k2e5

hmp catalog watch#

$ hmp catalog watch [-h] [-w WORKSPACE] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--stale-minutes STALE_MINUTES]

Read the outcome.json and logs/heartbeat.json of every run directory and list the attempts that are running. The index is never opened: this answers while a solve is going on and on a project that has no index yet.

ArgumentWhat it does
--stale-minutes STALE_MINUTESHeartbeat age (minutes) beyond which a running attempt is flagged stale default 5.0

Also takes the shared options --workspace --format --verbosity --quiet --verbose --debug.

Example

$ hmp catalog watch --stale-minutes 5

Exit codes it sets itself: 10. All exit codes.

hmp catalog import#

$ hmp catalog import [-h] [-w WORKSPACE] [--dry-run] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--name NAME] source

Import a run written by 'hmp publish' (directory or tar), with the data it read

ArgumentWhat it does
sourceDirectory or tar written by 'hmp publish'
--name NAMEName of the imported run (default: the published name without its _vN)

Also takes the shared options --workspace --dry-run --format --verbosity --quiet --verbose --debug.

The run lands under runs/ with the next free version of its name, read without its _vN: a published x_v2 becomes x in a project that has no x. Pass --name to give it the name other documents cite.

A copy carries its inputs unless it was published with --without inputs, so it installs every file the run read into data/ of the workspace: identical bytes already there cost nothing, other bytes at the same path are refused by name, and nothing is written.

Examples

$ hmp catalog import baseline.tar
$ hmp catalog import ../published/baseline --name lab_copy

hmp catalog rerun#

$ hmp catalog rerun [-h] [-w WORKSPACE] [--dry-run] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--site SITE] [--set PATH=VALUE] [--name NAME] SIM_REF

Launch a run again from its frozen config.toml, with --set path=value overrides

ArgumentWhat it does
SIM_REFFull sim_id, unique hex prefix, name, or an @-selector (@last, @best:METRIC, @worst:METRIC, @running)
--set PATH=VALUEDotted config path override, repeatable (e.g. flow.param.K.field.value=2e-4) The grammar of a key path and a value
--name NAMEName of the new run (default: the name of the source, next version)

Also takes the shared options --workspace --dry-run --format --verbosity --quiet --verbose --debug --site.

The new run keeps the name of its source and takes the next version; its manifest names the source in lineage (parent_sim_id, kind = rerun). A key that differs from config.resolved.toml of the source gets a warning and is recorded in lineage.drift.

Example

$ hmp catalog rerun baseline --set flow.param.K.field.value=2e-4

Exit codes it sets itself: 2. All exit codes.