hf jobs run adds retries, rerun, schedule rescheduling, and port exposure
Introduced 2026-10-01 · score 0.98
HOW TO USE IT
When maintaining a Hugging Face Job workflow, use `--attempts` to retry failures, `hf jobs rerun` to create a fresh Job from a saved spec, and `hf jobs scheduled reschedule` to change a schedule. Use `hf jobs expose` to replace exposed ports on a running Job.
hf jobs run --attempts 3 --detach python:3.12 python train.pyhf jobs rerun <job_id>hf jobs scheduled reschedule <scheduled_job_id> "0 9 * * 1"
hf jobs expose <job_id> 8000 --public 9000WHY THIS HELPS
When maintaining a Hugging Face Job workflow, retry failed jobs, rerun saved job specifications, reschedule scheduled jobs, or expose job ports.
REQUIREMENTS AND LIMITATIONS
- Version: v2.1.0
- --attempts <n>: Maximum attempts, including the first run; defaults to 1. `3` allows two retries.
- --detach: Run the Job in the background and print its ID.
- JOB_ID (required): Job ID to rerun or expose ports for.
- SCHEDULED_JOB_ID (required): Scheduled Job ID to reschedule.
- SCHEDULE (required): Cron expression or supported preset such as `@daily` or `@hourly`.
- PORTS: Positional ports to expose with token-protected access; omitted ports are closed when replacing the configuration.
- --public INTEGER: Expose a port without authentication; repeat for multiple ports. May be combined with positional token-protected ports.
- --clear: Close all exposed ports.
- Prerequisite: The machine must be logged in to Hugging Face; Jobs require a positive credit balance.
- Prerequisite: Manage only Jobs you own or Jobs in organizations where you have write permission.
- Prerequisite: Accessing token-protected exposed ports requires an HF token with read access to the Job's namespace.
- Retries are automatic on failure.
- A rerun starts a fresh Job using an existing Job's saved spec, including secrets and hardware settings.
- Scheduled Jobs can change their cron expression or preset without being recreated.
- Port exposure may be configured at Job creation time or on a running Job.
- `expose` provides token-protected access; `expose_public` provides unauthenticated access.
FIRST-PARTY EVIDENCE
- https://github.com/huggingface/huggingface_hub/releases/tag/v2.1.0
- https://huggingface.co/docs/huggingface_hub/v2.1.1/en/guides/cli
- https://huggingface.co/docs/huggingface_hub/main/en/guides/jobs
- https://huggingface.co/docs/huggingface_hub/v2.2.0/guides/cli
- https://huggingface.co/docs/huggingface_hub/v2.2.0.rc0/package_reference/cli
- https://huggingface.co/docs/huggingface_hub/v2.2.0/package_reference/cli
- https://huggingface.co/docs/huggingface_hub/v2.1.1/en/guides/jobs
- https://github.com/huggingface/huggingface_hub/blob/main/docs/source/en/guides/jobs.md
- https://huggingface.co/docs/hub/jobs-configuration
Check the installed version and the source before using it. Entry JSON