What a program reads#

This page is the interface of hmp for a script or a platform. --format json and --format csv print the result of a command in a shape that does not move inside a major version. --format table, the default, is for people and promises nothing.

The envelope#

--format json prints one JSON object on stdout, and nothing else. It has two keys:

{"schema": "hmp.catalog.ls.v1", "data": []}

schema names the command and the version of what data holds. data is an array of rows for a command that lists, and an object for any other. A listing with nothing to list is an empty array, never a sentence. Everything else a command says, a solver and a library included, goes to stderr, so stdout always parses. The result is written once the command is over. A value that is not a number in JSON, NaN or an infinity, is null, and a path or a date is a string.

--format csv prints the same rows with a header, and an empty listing is the header alone. An object is key,value lines, or its own table when it holds one: the cases of hmp ls --plan, the files of hmp example show, the states of hmp catalog reindex. A list in a cell is joined with ; and a mapping is written key=value, so a cell is always one line.

What is promised#

Inside a major version a field keeps its name and its meaning. A new field can come in a minor version, so a reader ignores what it does not know. When a field has to change or leave, the number in schema goes up and the rules of Versions and stability apply. A command marked experimental below follows the experimental rule of that page. A row marked open can hold more columns than the ones listed: the columns of a query, a metric the command was asked to rank by.

When a command fails#

A command that fails ends with the code of Exit codes and prints its HMPY.Exxx first on a line of stderr. Under --format json, stdout also holds an envelope of its own, unless the command had a result to write:

{"schema": "hmp.error.v1", "data": {"code": "HMPY.E002", "title": "...", "detail": "...", "exit_code": 10}}

A mistake on the command line itself, such as a flag that does not exist, is found before --format is read, so it only has its line on stderr and exit code 2.

A command that reports a result and a failure writes both: hmp doctor lists its checks and exits 1 when one is KO, hmp publish --verify lists its differences and exits 1.

What each command writes#

The commands that are not listed print a document that is the result itself, and an envelope would break it: hmp config template, hmp config resolve, hmp config schema, hmp config wizard and hmp completion.

The JSON Schema of the result of hmp calibrate ships as hydromodpy/schema/results/calibrate.v1.json.

Command

schema

data

Fields

hmp run

hmp.run.v1

object

workflow, config, dry_run, result

hmp replay

hmp.replay.v1

object

ref, source, sim_id, name, rel_dir, class, basis, differs, added, removed, changes, strict

hmp calibrate

hmp.calibrate.v1

object, experimental

session_id, method, status, n_trials, best_cost, duration_s, save_runs, promoted, best_cases, best_sim_id, best_rel_dir, cost_name, cost_label, best_trial, best_parameters, windows, parameter_uncertainty, cost_block_fractions, workspace, session_dir, phases, frozen, reused_from_disk, restart_spreads, steady_window, protocol, methods_paragraph, methods_path, extra

hmp calibrate --list-phases, --expand

hmp.calibrate.phases.v1

object, experimental

protocol, phases, calibration

hmp calibrate --dry-run

hmp.calibrate.plan.v1

object, experimental

case, session_dir, run_dir, save_runs, phases, solves_in_parallel

hmp spinup

hmp.spinup.v1

object

applied, converged, n_cycles, cycles, restart_from, warning, production_sim_id

hmp export

hmp.export.v1

object

files, regenerated

hmp export --list

hmp.export.list.v1

rows

name, kind

hmp export deliver

hmp.export.deliver.v1

object

deliveries

hmp publish

hmp.publish.v1

object

applied, copies, left_out, package, next

hmp publish --verify

hmp.publish.verify.v1

object

copy, members, problems

hmp workspace init

hmp.workspace.init.v1

object

path, workspace_toml

hmp workspace list

hmp.workspace.list.v1

rows

project, name, site, solver, nse, created_at, sim_id

hmp workspace clean

hmp.workspace.clean.v1

object

workspace, applied, results, indexes, caches

hmp project new

hmp.project.new.v1

object

path

hmp project plan

hmp.project.plan.v1

object

plan_hash, path, n_cases, n_sites, n_recipes, n_sealed

hmp project log

hmp.project.log.v1

rows, open

at, event, case_id, status, exit_code, signal, rel_dir, error, log, log_tail

hmp project list

hmp.project.list.v1

rows

name, path, has_project_toml, run_tomls

hmp project delete

hmp.project.delete.v1

object

project, path, applied, bytes_freed, published

hmp project import

hmp.project.import.v1

object

applied, project, path, written, unchanged, runs, sessions, mesh_entries

hmp campaign case

hmp.campaign.case.v1

object

path

hmp campaign array

hmp.campaign.array.v1

object

directory, plan_hash, n_cases, cases_txt, prepare_sh, array_sh, cpus_per_task, threads_per_case, max_solves, prepare_parallel

hmp campaign collect

hmp.campaign.collect.v1

object

summary, by_case, by_site, catalog, report, readme, figures_not_drawn

hmp campaign prune

hmp.campaign.prune.v1

object

case, applied, trials

hmp campaign promote

hmp.campaign.promote.v1

object

case, trial, rel_dir

hmp site add

hmp.site.add.v1

object

site, label, gauge, uri, x_outlet, y_outlet, crs, tags, catalog

hmp site import

hmp.site.import.v1

object

applied, catalog, skipped, sites

hmp site ls

hmp.site.ls.v1

rows

site, label, gauge, uri, x_outlet, y_outlet, crs, tags

hmp site show

hmp.site.show.v1

object

site, label, gauge, uri, x_outlet, y_outlet, crs, tags

hmp ls

hmp.ls.v1

rows, open

sim_id, name, project, site, case_id, rel_dir, solver, status, label, nse, created_at, started_at, duration_s, n_cells, n_layers, mesh_engine, solution_key, version_int, overrides, score_station, score_variable, score_window_start, score_window_end, metric_rule_version

hmp ls disk

hmp.ls.disk.v1

rows

name, kind, run_dir, sim_id, request_id, status, identical_to, project_root, mesh_summary, deliveries

hmp ls plan

hmp.ls.plan.v1

object

plan_hash, plan_stale, counts, cases

hmp catalog query

hmp.catalog.query.v1

rows, open

the columns of the result

hmp show run

hmp.show.run.v1

object

sim_id, name, project, site, case_id, rel_dir, solver, status, label, label_date, nse, duration_s, n_cells, n_timesteps, version_int, solution_key, replay, exports, figures, profile, zarr_path, zarr_exists, zarr_groups

hmp show point

hmp.show.point.v1

rows, open

the columns of the result

hmp show table

hmp.show.table.v1

rows, open

the columns of the result

hmp show profile

hmp.show.profile.v1

object

present, message, total_s, start_s, solve_s, attempts, solve, longest_steps, reused, max_rss_mb

hmp show profile session

hmp.show.profile.session.v1

rows, open

the columns of the result

hmp show rank

hmp.show.rank.v2

rows

sim_id, name, solver, station, variable, metric, value, window_start, window_end, metric_rule_version

hmp catalog gc

hmp.catalog.gc.v1

object

applied, keep_versions, max_age_days, trial_fields_days, solver_files_days, projects

hmp catalog reindex

hmp.catalog.reindex.v1

object

index, full, indexed, sessions, removed, skipped, rows

hmp catalog trash move

hmp.catalog.trash.move.v1

object

applied, rel_dir, trashed_to

hmp catalog delete

hmp.catalog.delete.v1

object

rel_dir, applied, removed_for_good, trashed_to

hmp catalog restore

hmp.catalog.restore.v1

object

applied, rel_dir

hmp catalog trash

hmp.catalog.trash.v1

rows

name, rel_dir, trashed_at

hmp catalog trash --empty

hmp.catalog.trash.empty.v1

object

applied, removed, kept_pinned

hmp catalog tag

hmp.catalog.tag.v1

object

rel_dir, added, removed, tags

hmp catalog note

hmp.catalog.note.v1

object

rel_dir, text

hmp catalog rename

hmp.catalog.rename.v1

object

applied, rel_dir, renamed

hmp diff

hmp.diff.v1

object

a, b, params, metrics

hmp diff folder

hmp.diff.folder.v1

object

folder

hmp catalog watch

hmp.catalog.watch.v1

rows

rel_dir, case_id, sim_id, attempt, attempt_id, host, pid, step, started_at, heartbeat_at, age_s, stale, dead

hmp catalog import

hmp.catalog.import.v1

object

applied, rel_dir, name, written, unchanged, next

hmp catalog rerun

hmp.catalog.rerun.v1

object

applied, source, rel_dir, sim_id

hmp stop

hmp.stop.v1

object

ref, flag

hmp show report session

hmp.show.report.session.v1

object

path

hmp show report

hmp.show.report.v2

object

html_report, report_json, missing

hmp show

hmp.show.v1

object

name, method, status, trials_by_status, best_trial, best_cost, cost_label, scored_on, stop, bounds_reached, calibrated_variable, report, profile

hmp show project

hmp.show.project.v1

object

name, path, has_project_toml, configs, n_runs, runs, n_sessions, sessions, n_trials, plan, has_summary, n_trashed, has_index

hmp config figures

hmp.config.figures.v3

rows

name, kind, frame, label, unit, detail, status

hmp show figure

hmp.show.figure.v1

object

path

hmp show figure data

hmp.show.figure.data.v1

object

paths

hmp check

hmp.check.v1

object

ok, diagnostics, workspace

hmp config targets

hmp.config.targets.v1

rows

name, path, instance, current, units, physical_bounds, registry_id

hmp process ls

hmp.process.ls.v1

rows

id, version, title

hmp process run

hmp.process.run.v1

object

schema, job_id, process, status, exit_code, started_at, finished_at, duration_s, reused, outputs, warnings, errors

hmp data ls

hmp.data.ls.v2

rows, open

variable, source, station_id, product, path, license

hmp data get

hmp.data.get.v1

object

files, failures, report

hmp data remove

hmp.data.remove.v1

object

applied, removed

hmp data prune

hmp.data.prune.v1

object

applied, older_than_days, removed, kept, orphans, user_files

hmp data archive

hmp.data.archive.v1

object

path

hmp data restore

hmp.data.restore.v1

object

source, path

hmp data lock

hmp.data.lock.v1

object

path, inputs, user_files, refused_configs

hmp data lock check

hmp.data.lock.check.v1

object

ok, schema_diverged, locked_schema, current_schema, mismatches

hmp example list

hmp.example.list.v1

rows

id, directory, title, summary, runtime, entry_config, file_count, total_size, missing_size

hmp example show

hmp.example.show.v1

object

id, directory, title, summary, runtime, entry_config, file_count, total_size, missing_size, files, data

hmp example add

hmp.example.add.v2

rows

example_id, workspace, project_dir, entry_config, source, downloaded, downloaded_bytes, written, unchanged, kept, stations_written

hmp privacy purge

hmp.privacy.purge.v1

object

applied, sim_id, rel_dir, removed_paths, certificate, archive, sha256_snapshot

hmp privacy verify

hmp.privacy.verify.v1

object

certificate, permissions_ok, permissions, sim_id, timestamp_utc, operator, reason, sha256_snapshot

hmp doctor

hmp.doctor.v1

object

python, platform, hydromodpy, checks

hmp install-binaries

hmp.install-binaries.v1

object

already_cached, release, installed, target

a failure

hmp.error.v1

object

code, title, detail, exit_code