---
title: "Job queue CLI reference"
description: "Customer-hosted cloud features"
---

# Job queue CLI reference

#### Customer-hosted cloud features

:::note
Some features are only available on customer-hosted clouds. Reach out to [support@anyscale.com](mailto:support@anyscale.com) for info.
:::

## Job queue CLI

### `anyscale job-queue list`

**Usage**

`anyscale job-queue list [OPTIONS]`

List job queues.

**Options**

-   **`--id`**: ID of a job queue.
-   **`--name`**: Filter by name.
-   **`--cloud`**: Filter by cloud.
-   **`--project`**: Filter by project.
-   **`--include-all-users/--only-mine`**: Include job queues not created by current user.
-   **`--cluster-status`**: Filter by cluster status.
-   **`--tag`**: This option can be repeated to filter by multiple tags. Tags with the same key are ORed, whereas tags with different keys are ANDed. Example: --tag team:mlops --tag team:infra --tag env:prod. Filters with team: (mlops OR infra) AND env:prod.
-   **`--view`**: Columns view.
-   **`--page-size`**: Items per page (max 50).
-   **`--max-items`**: Non-interactive max items.
-   **`--sort`**: Sort by FIELD (prefix with '-' for desc). Repeatable.
-   **`--interactive/--no-interactive`**: Enable interactive pagination.
-   **`-j/--json`**: JSON output.
-   **`--include-archived`**: Include archived job queues when searching by name. Ignored when using --id.

#### Examples

::::tabs

:::tab[CLI]
```bash
$ anyscale job-queue list
Output
JOB QUEUES:
             ID                 NAME              CLUSTER ID                      CREATOR ID             MAX CONCURRENCY    IDLE TIMEOUT SEC    CURRENT CLUSTER STATE
jq_h8fcze2qkr8wttuuvapi1hvyuc  queue_3  ses_cjr7uaf1yh2ue5uzvd11p24p4u  usr_we8x7d7u8hq8mj2488ed9x47n6          3                 5000               Terminated
jq_v5bx9z1sd4pbxasxhdms37j4gi  queue_2  ses_k86raeu6k1t6z1bvyejn3vblad  usr_we8x7d7u8hq8mj2488ed9x47n6         10                 5000               Terminated
jq_ni6hk66nt3194msr7hzzj9daun  queue_1  ses_uhb8a9gamtarz68kcurpjh86sa  usr_we8x7d7u8hq8mj2488ed9x47n6         10                 5000               Terminated
```
:::

::::

### `anyscale job-queue update`

**Usage**

`anyscale job-queue update [OPTIONS]`

Update job queue settings.

**Options**

-   **`--id`**: ID of the job queue.
-   **`--name/-n`**: Name of the job queue.
-   **`--project/-p`**: Project name (required when using --name).
-   **`--cloud`**: Cloud name (required when using --name).
-   **`--max-concurrency`**: Max number of concurrent jobs.
-   **`--idle-timeout-s`**: Idle timeout in seconds.
-   **`--json`**: JSON output.

#### Examples

::::tabs

:::tab[CLI]
```bash
$ anyscale job-queue update --id jq_h8fcze2qkr8wttuuvapi1hvyuc --max-concurrency 5
Output
ID                            : jq_h8fcze2qkr8wttuuvapi1hvyuc
USER PROVIDED ID              : queue_3
NAME                          : queue_3
CURRENT JOB QUEUE STATE       : ACTIVE
EXECUTION MODE                : PRIORITY
MAX CONCURRENCY               : 5
IDLE TIMEOUT SEC              : 5000
CREATED AT                    : 2025-04-15 20:40:44
CREATOR ID                    : usr_we8x7d7u8hq8mj2488ed9x47n6
CREATOR EMAIL                 : test@anyscale.com
COMPUTE CONFIG ID             : cpt_8hzsv1t4jvb6kwjhfqbfjw5i6b
CURRENT CLUSTER STATE         : Terminated
CLUSTER ID                    : ses_cjr7uaf1yh2ue5uzvd11p24p4u
PROJECT ID                    : prj_7FWKGPGPaD3Q5mvk9zK2viBD
CLOUD ID                      : cld_kvedZWag2qA8i5BjxUevf5i7
TOTAL JOBS                    : 6
SUCCESSFUL JOBS               : 6
FAILED JOBS                   : 0
ACTIVE JOBS                   : 0
```
:::

::::

### `anyscale job-queue status`

**Usage**

`anyscale job-queue status [OPTIONS]`

Show job queue details.

**Options**

-   **`--id`**: ID of the job queue.
-   **`--name/-n`**: Name of the job queue.
-   **`--project/-p`**: Project name to filter by when using --name.
-   **`--cloud`**: Cloud name to filter by when using --name.
-   **`--view`**: Columns view.
-   **`--json`**: JSON output.
-   **`--include-archived`**: Include archived job queues when searching by name. Ignored when using --id.

#### Examples

::::tabs

:::tab[CLI]
```bash
$ anyscale job-queue status --id jq_h8fcze2qkr8wttuuvapi1hvyuc
Output
ID                            : jq_h8fcze2qkr8wttuuvapi1hvyuc
USER PROVIDED ID              : queue_3
NAME                          : queue_3
CURRENT JOB QUEUE STATE       : ACTIVE
EXECUTION MODE                : PRIORITY
MAX CONCURRENCY               : 3
IDLE TIMEOUT SEC              : 5000
CREATED AT                    : 2025-04-15 20:40:44
CREATOR ID                    : usr_we8x7d7u8hq8mj2488ed9x47n6
CREATOR EMAIL                 : test@anyscale.com
COMPUTE CONFIG ID             : cpt_8hzsv1t4jvb6kwjhfqbfjw5i6b
CURRENT CLUSTER STATE         : Terminated
CLUSTER ID                    : ses_cjr7uaf1yh2ue5uzvd11p24p4u
PROJECT ID                    : prj_7FWKGPGPaD3Q5mvk9zK2viBD
CLOUD ID                      : cld_kvedZWag2qA8i5BjxUevf5i7
TOTAL JOBS                    : 6
SUCCESSFUL JOBS               : 6
FAILED JOBS                   : 0
ACTIVE JOBS                   : 0
```
:::

::::

### `anyscale job-queue archive`

**Usage**

`anyscale job-queue archive [OPTIONS]`

Archive (seal) a job queue. No new jobs can be submitted.

**Options**

-   **`--id`**: ID of the job queue.
-   **`--name/-n`**: Name of the job queue.
-   **`--project`**: Project name (required with --name).
-   **`--cloud`**: Cloud name (required with --name).

#### Examples

::::tabs

:::tab[CLI]
```bash
$ anyscale job-queue archive --id jq_abc123
Archiving job queue 'jq_abc123'...
Job queue 'jq_abc123' has been archived.
Query the status with `anyscale job-queue status --id jq_abc123`.

$ anyscale job-queue archive --name my-queue --project my-project --cloud my-cloud
Archiving job queue 'my-queue'...
Job queue 'my-queue' has been archived.
Query the status with `anyscale job-queue status --id jq_abc123`.
```
:::

::::

### `anyscale job-queue terminate`

**Usage**

`anyscale job-queue terminate [OPTIONS]`

Terminate a job queue and all its pending/running jobs.

**Options**

-   **`--id`**: ID of the job queue.
-   **`--name/-n`**: Name of the job queue.
-   **`--project`**: Project name (required with --name).
-   **`--cloud`**: Cloud name (required with --name).
-   **`--include-archived`**: Include archived job queues when searching by name. Ignored when using --id.

#### Examples

::::tabs

:::tab[CLI]
```bash
$ anyscale job-queue terminate --id jq_abc123
Terminating job queue 'jq_abc123'...
Job queue 'jq_abc123' has been marked for termination.
Query the status with `anyscale job-queue status --id jq_abc123`.

$ anyscale job-queue terminate --name my-queue --project my-project --cloud my-cloud
Terminating job queue 'my-queue'...
Job queue 'my-queue' has been marked for termination.
Query the status with `anyscale job-queue status --id jq_abc123`.
```
:::

::::

### `anyscale job-queue delete`

**Usage**

`anyscale job-queue delete [OPTIONS]`

Delete a job queue. Jobs previously submitted remain accessible.

**Options**

-   **`--id`**: ID of the job queue.
-   **`--name/-n`**: Name of the job queue.
-   **`--project`**: Project name (required with --name).
-   **`--cloud`**: Cloud name (required with --name).
-   **`--include-archived`**: Include archived job queues when searching by name. Ignored when using --id.

#### Examples

::::tabs

:::tab[CLI]
```bash
$ anyscale job-queue delete --id jq_abc123
Deleting job queue 'jq_abc123'...
Job queue 'jq_abc123' has been deleted.

$ anyscale job-queue delete --name my-queue --project my-project --cloud my-cloud
Deleting job queue 'my-queue'...
Job queue 'my-queue' has been deleted.
```
:::

::::

### `anyscale job-queue tags add`

**Usage**

`anyscale job-queue tags add [OPTIONS]`

Add or update tags on a job queue.

**Options**

-   **`--id`**: ID of a job queue.
-   **`--name/-n`**: Name of a job queue.
-   **`--tag`**: Tag in key=value (or key:value) format. Repeat to add multiple.

#### Examples

::::tabs

:::tab[CLI]
```bash
$ anyscale job-queue tags add --name my-queue --tag team=data --tag priority=high
```
:::

::::

### `anyscale job-queue tags remove`

**Usage**

`anyscale job-queue tags remove [OPTIONS]`

Remove tags by key from a job queue.

**Options**

-   **`--id`**: ID of a job queue.
-   **`--name/-n`**: Name of a job queue.
-   **`--key`**: Tag key to remove. Repeatable.

#### Examples

::::tabs

:::tab[CLI]
```bash
$ anyscale job-queue tags remove --name my-queue --key team --key priority
```
:::

::::

### `anyscale job-queue tags list`

**Usage**

`anyscale job-queue tags list [OPTIONS]`

List tags for a job queue.

**Options**

-   **`--id`**: ID of a job queue.
-   **`--name/-n`**: Name of a job queue.
-   **`--json`**: JSON output.

#### Examples

::::tabs

:::tab[CLI]
```bash
$ anyscale job-queue tags list --name my-queue --json
```
:::

::::

## Job queue models

### `JobQueueStatus`

Represents the status and details of a Job Queue.

#### Fields

-   **`id` (str)**: Unique ID of the job queue.
-   **`state` (str)**: Current state of the job queue.
-   **`name` (str | None)**: Name of the job queue.
-   **`creator_email` (str | None)**: Email of the user who created the job queue.
-   **`project_id` (str | None)**: ID of the project this job queue belongs to.
-   **`created_at` (datetime | None)**: Timestamp when the job queue was created.
-   **`max_concurrency` (int | None)**: Maximum number of jobs allowed to run concurrently.
-   **`idle_timeout_s` (int | None)**: Idle timeout in seconds before the queue's cluster may shut down.
-   **`user_provided_id` (str | None)**: User provided identifier of the job queue.
-   **`execution_mode` (str | None)**: The execution mode of the job queue.
-   **`creator_id` (str | None)**: Identifier of user who created the job queue.
-   **`cloud_id` (str | None)**: The cloud ID associated with the job queue.
-   **`total_jobs` (int | None)**: Total number of jobs in the job queue.
-   **`successful_jobs` (int | None)**: Number of successful jobs in the job queue.
-   **`failed_jobs` (int | None)**: Number of failed jobs in the job queue.
-   **`active_jobs` (int | None)**: Number of active jobs in the job queue.

#### Python Methods

```python
def to_dict(self) -> Dict[str, Any]
    """Return a dictionary representation of the model."""
```

#### Examples

::::tabs

:::tab[Python]
```python
from anyscale.job_queue.models import JobQueueStatus

status = JobQueueStatus(
    id="jq_123",
    state="ACTIVE",
    name="my-queue",
    max_concurrency=5,
    idle_timeout_s=300,
)
```
:::

::::

### `JobQueueState`

Current state of a job queue.

#### Values

-   **`ACTIVE`**: The job queue is active and accepting jobs.
-   **`SEALED`**: The job queue is sealed and not accepting new jobs. It may still be processing existing jobs.
-   **`UNKNOWN`**: The state of the job queue is unknown or could not be determined.

### `ExecutionMode`

Execution mode of a job queue.

#### Values

-   **`FIFO`**: FIFO execution mode.
-   **`LIFO`**: LIFO execution mode.
-   **`PRIORITY`**: Priority-based execution mode.
-   **`UNKNOWN`**: Unknown execution mode.

### `ClusterState`

Possible states for a cluster.

#### Values

-   **`RUNNING`**: The cluster is running.
-   **`TERMINATED`**: The cluster is terminated.
-   **`PENDING`**: The cluster is pending creation.
-   **`UNKNOWN`**: The state of the cluster is unknown.

### `JobQueueSortField`

Fields available for sorting job queues.

#### Values

-   **`ID`**: Sort by Job Queue ID.
-   **`NAME`**: Sort by Job Queue name.
-   **`CREATED_AT`**: Sort by creation timestamp.
-   **`CREATOR_ID`**: Sort by the ID of the creator.
-   **`CREATOR_EMAIL`**: Sort by the email of the creator.
-   **`PROJECT_ID`**: Sort by the Project ID.
-   **`CLOUD_ID`**: Sort by the Cloud ID.
-   **`QUEUE_STATE`**: Sort by the Job Queue's state (ACTIVE, SEALED).
-   **`CLUSTER_STATE`**: Sort by the state of the associated cluster.

### `JobQueueSortDirective`

Directive for sorting job queue results.

#### Fields

-   **`sort_field` ([JobQueueSortField](#jobqueuesortfield) | str)**: The field to sort by.
-   **`sort_order` ([SortOrder](#sortorder) | str)**: The sort order (ASC or DESC).

#### Python Methods

```python
def to_dict(self) -> Dict[str, Any]
    """Return a dictionary representation of the model."""
```

#### Examples

::::tabs

:::tab[Python]
```python
from anyscale.job_queue.models import JobQueueSortDirective, JobQueueSortField, SortOrder

# Create a sort directive
sort_directive = JobQueueSortDirective(
    sort_field=JobQueueSortField.CREATED_AT,
    sort_order=SortOrder.DESC
)
```
:::

::::

### `SortOrder`

Sort order for queries.

#### Values

-   **`ASC`**: Ascending order.
-   **`DESC`**: Descending order.

### `SessionState`

State of a cluster/session.

#### Values

-   **`Stopped`**: The cluster is stopped.
-   **`Terminated`**: The cluster is terminated.
-   **`StartingUp`**: The cluster is starting up.
-   **`StartupErrored`**: The cluster encountered an error during startup.
-   **`Running`**: The cluster is running.
-   **`Updating`**: The cluster is being updated.
-   **`UpdatingErrored`**: The cluster encountered an error during update.
-   **`Stopping`**: The cluster is stopping.
-   **`Terminating`**: The cluster is terminating.
-   **`AwaitingStartup`**: The cluster is awaiting startup.
-   **`AwaitingFileMounts`**: The cluster is awaiting file mounts.
-   **`TerminatingErrored`**: The cluster encountered an error during termination.
-   **`StoppingErrored`**: The cluster encountered an error while stopping.

---

Previous: [Image](/reference/cli/image.md) | Next: [Job](/reference/cli/job.md)