Follow a record into its fields, name the metrics, name the version
Docs / docs (push) Successful in 38s
Playwright Tests / test-playwright (1, 2) (push) Successful in 2m56s
Playwright Tests / test-playwright (2, 2) (push) Successful in 2m7s
pre-commit / pre-commit (push) Failing after 2m17s
Test Backend / test-backend (push) Successful in 2m54s
Compose Smoke Test / test-compose (push) Successful in 44s
Playwright Tests / merge-reports (push) Successful in 1m17s
Docs / docs (push) Successful in 38s
Playwright Tests / test-playwright (1, 2) (push) Successful in 2m56s
Playwright Tests / test-playwright (2, 2) (push) Successful in 2m7s
pre-commit / pre-commit (push) Failing after 2m17s
Test Backend / test-backend (push) Successful in 2m54s
Compose Smoke Test / test-compose (push) Successful in 44s
Playwright Tests / merge-reports (push) Successful in 1m17s
Three things the first export pass got wrong for a real study. **Dotted paths.** A node returns a record, not a scalar — the numbers arrive inside `final_metrics` — so `--metrics final_metrics.train_loss` yielded an empty column and `--metrics final_metrics` yielded the whole record in one cell. Both sides of the wide table now take dotted paths, and the defaults reach the same depth: every number a result carries is a column named by its path, and inputs are compared leaf by leaf, so two configurations differing in one field give that field as the axis rather than two blobs that are merely not equal. Lists stay whole — a curve belongs in the long table. **`--list`.** Metric names are flow-qualified, so `--name train_loss` matched nothing and said only that. `fluksio export metrics --list` prints the names the selection carries, and an empty export made with `--name` points at it. **A version to compare.** The CLI ships ahead of the engine and a stale one answered a flat 404 with nothing anywhere in the API to tell how old it was. The engine reports `version` on `/observability/summary`, `fluksio status` prints it, and a 404 from export now names both versions — or says "older" when the field itself predates the engine. Bumped to 0.1.5, which is what makes the number worth reading. Also formats `flow/metrics.py`, which had been committed unformatted and was the last `ruff format --check` failure. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A9Hdrmf2cwNABCnE5x9UJa
This commit is contained in:
@@ -345,3 +345,46 @@ def test_an_export_is_parsed_with_its_selection() -> None:
|
||||
assert runs.func is cmd_export_runs
|
||||
assert runs.params == "lr"
|
||||
assert runs.format == "jsonl"
|
||||
|
||||
|
||||
def test_the_metric_names_are_asked_for_rather_than_guessed() -> None:
|
||||
"""A name is flow-qualified, so `--list` is what says what would match."""
|
||||
from fluksio.cli import _parser
|
||||
from fluksio.sdk.cli import _list_names
|
||||
|
||||
parser = _parser()
|
||||
assert parser.parse_args(["export", "metrics"]).list_names is False
|
||||
assert parser.parse_args(["export", "metrics", "--list"]).list_names is True
|
||||
|
||||
class Engine:
|
||||
def runs(self, flow="", limit=0, **filters):
|
||||
assert filters == {"status": "ok"}
|
||||
return [{"id": "r-empty"}, {"id": "r-1"}]
|
||||
|
||||
def metrics(self, run_id, name="", stride=1):
|
||||
# The newest run failed before it measured anything; the next one
|
||||
# carries the vocabulary.
|
||||
return [] if run_id == "r-empty" else [{"name": "train.train_loss"}]
|
||||
|
||||
args = parser.parse_args(
|
||||
["export", "metrics", "--flow", "train", "--status", "ok", "--list"]
|
||||
)
|
||||
assert _list_names(Engine(), args) == 0
|
||||
|
||||
|
||||
def test_an_engine_without_the_route_is_named_rather_than_404() -> None:
|
||||
"""A client ships ahead of the engine; a flat 404 does not say so."""
|
||||
from fluksio.sdk.cli import _too_old
|
||||
|
||||
class Old:
|
||||
def summary(self):
|
||||
return {"status": "ok", "version": "0.1.4"}
|
||||
|
||||
class Ancient:
|
||||
def summary(self):
|
||||
# Older than the field itself.
|
||||
return {"status": "ok"}
|
||||
|
||||
assert "engine is 0.1.4" in _too_old(Old())
|
||||
assert "engine is older" in _too_old(Ancient())
|
||||
assert "pip install -U fluksio" in _too_old(Ancient())
|
||||
|
||||
Reference in New Issue
Block a user