Skip to content

[v1.21.0] Jobs filtering & pagination

Latest

Choose a tag to compare

@github-actions github-actions released this 25 Jun 12:48
· 2 commits to main since this release

📊 Jobs listing revamped: filter, paginate, and ls instead of ps

The Jobs listing API and CLI have been overhauled with server-side filtering, proper pagination, and a CLI rename that aligns with the rest of hf. list_jobs() now accepts status and labels parameters that push filtering to the server, and returns a lazy iterator (matching list_models, list_datasets, etc.) so large result sets are fetched page by page. On the CLI side, hf jobs ps has been renamed to hf jobs ls for consistency with hf repos ls, hf models ls, and friends — ps and list still work as aliases.

⚠️ Breaking changes:

  • list_jobs() now returns an Iterable[JobInfo] instead of list[JobInfo]. If you indexed the result (jobs[0]), wrap it with list(...).
  • -f/--filter in hf jobs ls is deprecated. Use --status and --label instead. Glob patterns (data-*), negation (key!=value), and filtering by id/image/command are no longer supported.
from huggingface_hub import list_jobs

# Filter by status and labels
list_jobs(status=["RUNNING", "SCHEDULING"], labels={"env": "prod"})

# Iterate lazily
for job in list_jobs():
    print(job.id)

# Materialize all results
all_jobs = list(list_jobs())
# Filter by status and labels
hf jobs ls --status running,scheduling --label env=prod --label team=ml

# Paginate with --limit
hf jobs ls -a --limit 500
hf jobs ls -a --limit 0  # no limit
  • [Jobs] Add stage/label filtering to list_jobs API and CLI by @Wauplin in #4395
  • [Jobs] Paginate list_jobs and add --limit to hf jobs ps by @Wauplin in #4403
  • [CLI] [Jobs] Rename job listing to 'hf jobs ls' (and keep 'hf jobs ps' alias) by @Wauplin in #4409

📚 Documentation: CLI guide, Jobs guide

🐛 Fix circular import on from huggingface_hub import login

A regression introduced in v1.20.0 caused from huggingface_hub import login to raise an ImportError on a fresh interpreter, due to a circular dependency between _oauth_device and utils._http. The fix moves _oauth_device.py into the utils layer so all imports resolve downward, eliminating the cycle. No lazy imports or workarounds required.

🔧 Other QoL Improvements

📖 Documentation

🐛 Bug and typo fixes

  • [Serialization] Exclude skipped string tensors from single-shard index by @nyxst4ck in #4391
  • Fix IndexError in filter_repo_objects on an empty allow/ignore pattern by @CharlesCNorton in #4402

🏗️ Internal

  • Post-release: bump version to 1.21.0.dev0 by @huggingface-hub-bot[bot] in #4383
  • [CI] Catch circular imports in the check-imports job by @hanouticelina in #4386
  • [Tests] Fix kernel tests for moved file on production by @Wauplin in #4387
  • [Release] Report trigger actor, drop social drafts, archive raw + edited notes by @Wauplin in #4388
  • [Tests] Fix flaky security-scan assertions by @Wauplin in #4392
  • [Bot] Update hardware flavor enums and docs by @huggingface-hub-bot[bot] in #4406
  • [CLI] Fix ty/mypy errors with click 8.4.2 by @Wauplin in #4408