{
  "slug": "hf-jobs-stats-and-fetch-job-metrics-return-a-snapshot-by-default-276e8cff527d",
  "title": "hf jobs stats and fetch_job_metrics return a snapshot by default",
  "tools": [
    "hf"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-10-08T14:54:20.000Z",
  "announced_at": "2026-10-08T14:54:20.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "For a running job, use `hf jobs stats <job-id>` or `fetch_job_metrics(job_id=..., follow=False)` to read the current metrics sample and return without waiting. Add `-f/--follow` or `follow=True` to stream until the job completes.",
    "examples": [
      "hf jobs stats <job-id>",
      "hf jobs stats --format json <job-id>",
      "from huggingface_hub import fetch_job_metrics\nfor metrics in fetch_job_metrics(job_id=\"<job-id>\", follow=False):\n    print(metrics)"
    ],
    "gotchas": [
      "Version: v2.2.0",
      "JOB_IDS: One or more job IDs; the CLI docs also allow `namespace/job_id`.",
      "-f, --follow: Stream live stats until the jobs complete; without it, print one snapshot.",
      "--format: The v2.2.0 release lists `json`, `agent`, and `quiet` for raw API metrics in snapshot output.",
      "job_id (required): The job ID for `fetch_job_metrics`.",
      "follow: Defaults to `False` and returns the current sample; `True` streams until the job completes, according to the v2.2.0 release.",
      "Snapshot output prints the latest sample of each job once and exits.",
      "Pass `follow=True` or use `-f/--follow` to stream until the job completes.",
      "Docs conflict: The current CLI reference documents `-f/--follow` and snapshot output but does not list `--format` under `hf jobs stats`; the v2.2.0 release explicitly says snapshot output supports `--format json|agent|quiet`. https://github.com/huggingface/huggingface_hub/blob/main/docs/source/en/package_reference/cli.md"
    ]
  },
  "why_it_matters": "Read metrics for a running job in a script or coding-agent workflow without waiting for the job to finish.",
  "before": "`hf jobs stats` and `HfApi.fetch_job_metrics` streamed metrics until the job finished, so callers of a running job could wait until their own timeout.",
  "sources": [
    "https://github.com/huggingface/huggingface_hub/releases/tag/v2.2.0",
    "https://github.com/huggingface/huggingface_hub/pull/5091",
    "https://github.com/huggingface/huggingface_hub/blob/main/docs/source/en/package_reference/cli.md",
    "https://huggingface.co/docs/huggingface_hub/v2.1.1/en/package_reference/hf_api"
  ],
  "rank": 0.98054,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave2b-20261017",
    "verdict_id": "wave2b-20261017:wave2b-20261017-2840f53bc9562c3f-0:gate",
    "evidence_hash": "4f28e8bbf2d8dc137afc1a35c1c459c6c57fe0fe4de6cb4a2047f08336d99c56"
  },
  "review": {
    "draft_hash": "e701f20d158372cda0c1b0e94607d790a29a88b42de3ba96b7b146154a6c2f12",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-08T14:54:20.000Z",
    "decision": "wave2b-20261017:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.98 >= 0.9; 2 needed) and Jev gave 0.82 (>= 0.6 needed)."
  }
}
