Skip to main content
By default, a job runs once and isn’t restarted. You can set up a job to be automatically restarted when its container exits with an error.
Automatic restarts aren’t available for Serverless AI endpoints.

Configuring automatic restarts

To turn automatic restarts on or off for a job, set the --restart-policy parameter when you create the job:
--restart-policy on-failure reacts to your container exiting with an error while the job is running. This is useful for workloads that can fail transiently and succeed on a retry, for example, a training step that occasionally crashes and can resume from a checkpoint.

When jobs aren’t restarted

--restart-policy responds only to the container’s own exit code. It does not 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.
In these cases, the job moves to the ERROR status and isn’t retried by --restart-policy. To run it again, create a new job or use nebius ai job restart.
For resilience against preemption or lost capacity, design your workload to be resumable, for example, write and resume from checkpoints, and resubmit the job rather than relying on --restart-policy.