Automatic restarts aren’t available for Serverless AI endpoints.
Prerequisites
- CLI
- Go SDK
- Python SDK
- JavaScript SDK
- REST API
-
Install and configure the Nebius AI Cloud CLI.
Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration:
-
Make sure you are in a group that has at least the
editorrole within your tenant or project; for example, the defaulteditorsgroup. You can check this in the Administration → IAM section of the web console.
Configuring automatic restarts
To turn automatic restarts on or off, set the restart policy when you create the job. In the CLI, use the--restart-policy parameter. In the SDKs and the REST API, use the restart attempts parameter: Spec.RestartAttempts in Go, spec.restart_attempts in Python and spec.restartAttempts in JavaScript and the REST API. The values correspond as follows:
Automatic restarts occur when your container exits with an error while the job is running. They are useful for workloads that can fail transiently and succeed on a retry, for example, a training workload that can resume from a checkpoint after a crash.
For example, to create a job whose container restarts on failure:
- CLI
- Go SDK
- Python SDK
- JavaScript SDK
- REST API
..., specify the other job parameters, as described in How to create a job.When jobs aren’t restarted
The restart policy responds only to the container’s own exit code. It doesn’t recover from:- No available capacity at start: if the requested compute can’t be allocated when the job starts.
- Preemption: if you run on preemptible compute and Nebius AI Cloud reclaims (preempts) the underlying virtual machine (VM).
- The underlying VM stopping unexpectedly.
- Startup failures and timeouts.
ERROR status and isn’t restarted automatically. To run it again, create a new job or restart it, for example with nebius ai job restart in the CLI.