> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baseten.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Training job queueing and priority

> See how Baseten admits training jobs against GPU quotas, set and change queue priority, and resolve capacity errors.

When you submit a job, Baseten checks it against your [GPU quotas](https://docs.baseten.co/training/gpu-capacity.md). A job that fits starts. When queueing is turned on for your organization, a job that has to wait for quota enters `TRAINING_JOB_PENDING`, and queue priority sets the order in which pending jobs start.

## How Baseten admits a job

Baseten compares each job's required GPU count with the applicable organization and team quotas, current usage, and pending jobs:

* If no eligible cluster has the required GPUs, Baseten rejects the submission with HTTP `429`, even when queueing is enabled.
* If the required GPUs are available, the job fits within the applicable GPU quotas, and no pending job ranks ahead of the submission, Baseten starts the job.
* If running jobs leave too little room under your organization's GPU quota, Baseten places the job in [`TRAINING_JOB_PENDING`](https://docs.baseten.co/training/lifecycle) when queueing is enabled for your organization. The job starts when quota becomes available and the job reaches the front of its queue.
* If the job requires more GPUs than the organization quota, Baseten rejects the submission. The job can't fit within the configured quota.
* If a job must wait for organization GPU quota, Baseten rejects the submission when queueing is disabled or the pending-job queue is full. Wait for running jobs to release quota before resubmitting. To discuss queueing and GPU quotas for your workload, [Contact us](mailto:support@baseten.co).

For example, an organization has a quota of 16 H100 GPUs, uses 12 of them, and has no pending jobs. Queueing is enabled, and the cluster has enough available GPUs:

| Submitted job | Result |
| - | - |
| Requires 4 H100 GPUs | Starts and brings usage to the 16-GPU quota. |
| Requires 8 H100 GPUs | Enters `TRAINING_JOB_PENDING` until running jobs release 4 H100 GPUs, leaving room for 8 under the organization quota. |
| Requires 24 H100 GPUs | Fails validation because the job exceeds the 16-GPU quota. |

A job that exceeds the organization quota returns an error that identifies the requested GPU count and the applicable quota:

```text theme={"system"}
This job requests 24 H100 GPUs, more than your organization's entire H100 GPU quota (16). Waiting will not help: request fewer GPUs or fewer nodes, or contact Baseten to raise the quota.
```

## Set queue priority

Priority reorders only jobs that are waiting for organization GPU quota. Higher values run first, and jobs default to priority `0`. Raise a job above `0` to run it sooner, or drop it below `0` to hold it behind default-priority work; the value is an unbounded integer. Priority doesn't pause a running job or add cluster capacity.

**To set a job's priority when you submit it**:

> [tab] Baseten CLI
>
> Pass `--priority` to [`baseten train push`](https://docs.baseten.co/reference/cli/baseten/train):
>
> ```bash theme={"system"}
> baseten train push --config config.py --priority 100
> ```

> [tab] Training SDK
>
> Set [`priority`](https://docs.baseten.co/reference/sdk/training#param-priority) on `TrainingJob` in `config.py`:
>
> ```python config.py theme={"system"}
> from truss_train import Compute, Image, Runtime, TrainingJob, TrainingProject
> from truss.base.truss_config import AcceleratorSpec
>
> training_job = TrainingJob(
>     image=Image(base_image="pytorch/pytorch:2.7.0-cuda12.8-cudnn9-runtime"),
>     compute=Compute(
>         accelerator=AcceleratorSpec(accelerator="H100", count=1),
>     ),
>     runtime=Runtime(
>         start_commands=["python train.py"],
>     ),
>     priority=100,
> )
>
> training_project = TrainingProject(name="qwen3-4b-lora-sft", job=training_job)
> ```

To check a submitted job's priority, run the following command:

```bash theme={"system"}
baseten train job describe --job-id <job_id>
```

The `Priority:` line holds the value.

## Change the priority of a pending job

You can change a job's priority only while the job is in the `TRAINING_JOB_PENDING` state.

> [tab] Baseten CLI
>
> **To change a pending job's priority**:
>
> 1. Run the following command, replacing `<job_id>` with the job ID and `<priority>` with the new priority:
>
>    ```bash theme={"system"}
>    baseten train job update --job-id <job_id> --priority <priority>
>    ```
>
>    The command prints the job ID and the new priority, as in `Set training job <job_id> priority to 100.`
>
> 2. To confirm, describe the job:
>
>    ```bash theme={"system"}
>    baseten train job describe --job-id <job_id>
>    ```
>
>    The `Priority:` line holds the new value.

> [tab] Training API
>
> **To change a pending job's priority**:
>
> The `curl` examples authenticate with `BASETEN_API_KEY`. Export your [API key](https://docs.baseten.co/organization/api-keys.md) first.
>
> Send a `PATCH` request to [Update a training job](https://docs.baseten.co/reference/training-api/update-training-job.md), replacing `<project_id>` and `<job_id>` with the project and job IDs:
>
> ```bash theme={"system"}
> curl --request PATCH \
>   --url "https://api.baseten.co/v1/training_projects/<project_id>/jobs/<job_id>" \
>   --header "Authorization: Bearer $BASETEN_API_KEY" \
>   --header "Content-Type: application/json" \
>   --data '{"priority": 100}'
> ```
>
> The response's `training_job.priority` is `100`.

## Resolve capacity errors

Read the submission error to choose whether to reduce the job's GPU request, wait for running work to finish, or request a higher quota:

| Error or symptom | What to do |
| - | - |
| The job requests more GPUs than the organization's quota for that GPU type. | Request fewer GPUs or nodes. To raise the quota, [Contact us](mailto:support@baseten.co). Waiting for other jobs to finish won't make the job fit. |
| No eligible cluster has the required GPUs. The submission returns HTTP `429`, even with queueing enabled. | Retry when cluster capacity is available, or contact support about capacity for your workload. |
| The job would exceed the organization's GPU quota because of current usage, and queueing is disabled. | Wait for running jobs to finish, or contact support about enabling queueing. |
| The pending-job queue is full. | Wait for jobs to leave the queue before resubmitting. Contact support if the queue doesn't accommodate your workload. |
| The job remains in `TRAINING_JOB_PENDING`. | If you're an organization admin, check [queue context](https://docs.baseten.co/reference/training-api/get-training-job-queue-context.md) for the capacity pool that blocked the job and the jobs using GPUs when it was submitted. [Raise the job's priority](#change-the-priority-of-a-pending-job) or [move it to spot capacity](https://docs.baseten.co/training/spot-capacity.md#move-a-queued-job-onto-spot-capacity). |

## Next steps

* [GPU capacity](https://docs.baseten.co/training/gpu-capacity.md): Check quotas and usage.
* [Spot capacity](https://docs.baseten.co/training/spot-capacity.md): Run jobs on idle GPUs instead of waiting.
