You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/en/guides/jobs.md
+86Lines changed: 86 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,6 +86,11 @@ This feature is pay-as-you-go: you only pay for the seconds you use.
86
86
>>> run_uv_job("my_script.py")
87
87
```
88
88
89
+
<Tipwarning>
90
+
91
+
**Important**: Jobs have a default timeout (30 minutes), after which they will automatically stop. For long-running tasks like model training, make sure to set a custom timeout using the `timeout` parameter. See [Configure Job Timeout](#configure-job-timeout) for details.
92
+
</Tip>
93
+
89
94
[`run_job`] returns the [`JobInfo`] which has the URL of the Job on Hugging Face, where you can see the Job status and the logs.
90
95
Save the Job ID from [`JobInfo`] to manage the job:
91
96
@@ -195,6 +200,87 @@ Available `flavor` options:
195
200
196
201
That's it! You're now running code on Hugging Face's infrastructure.
197
202
203
+
## Configure Job Timeout
204
+
205
+
Jobs have a default timeout (30 minutes), after which they will automatically stop. This is important to know when running long-running tasks like model training.
206
+
207
+
### Setting a custom timeout
208
+
209
+
You can specify a custom timeout value using the `timeout` parameter when running a job. The timeout can be specified in two ways:
If you don't specify a timeout, a default timeout will be applied to your job. For long-running tasks like model training that may take hours, make sure to set an appropriate timeout to avoid unexpected job terminations.
261
+
262
+
</Tip>
263
+
264
+
### Monitoring job duration
265
+
266
+
When running long tasks, it's good practice to:
267
+
- Estimate your job's expected duration and set a timeout with some buffer
268
+
- Monitor your job's progress through the logs
269
+
- Check the job status to ensure it hasn't timed out
For more details about the timeout parameter, see the [`run_job` API reference](https://huggingface.co/docs/huggingface_hub/package_reference/hf_api#huggingface_hub.HfApi.run_job.timeout).
283
+
198
284
## Pass Environment variables and Secrets
199
285
200
286
You can pass environment variables to your job using `env` and `secrets`:
0 commit comments