Skip to main content

Job Queue API Reference

Job Queue API Reference

Customer-hosted cloud features

note

Some features are only available on customer-hosted clouds. Reach out to 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.
  • --no-interactive/--interactive: Use non-interactive batch mode instead of interactive paging.
  • --json: JSON output.

Examples

$ 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.
  • --max-concurrency: Max number of concurrent jobs.
  • --idle-timeout-s: Idle timeout in seconds.
  • --json: JSON output.

Examples

$ 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.
  • --view: Columns view.
  • --json: JSON output.

Examples

$ anyscale job-queue info --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 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

$ 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

$ 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

$ anyscale job-queue tags list --name my-queue --json

Job Queue SDK

anyscale.job_queue.list

List job queues or fetch a single job queue by ID.

Arguments

  • job_queue_id (str | None) = None: If provided, fetches only the job queue with this ID.
  • name (str | None) = None: Filter by job queue name.
  • creator_id (str | None) = None: Filter by the user ID of the creator.
  • cloud (str | None) = None: Filter by cloud name.
  • project (str | None) = None: Filter by project name.
  • cluster_status (str | None) = None: Filter by the state of the associated cluster.
  • tags_filter (Dict[str, List[str]] | None) = None: Filter by tags. Accepts dict[key] -> List[values] or list['key:value'] entries.
  • page_size (int | None) = None: Number of items per API request page.
  • max_items (int | None) = None: Maximum total number of items to return.
  • sorting_directives (List[str] | None) = None: List of directives to sort the results.

Returns: ResultIterator[JobQueueStatus]

Examples

import anyscale

# Example: List the first 50 job queues
for jq in anyscale.job_queue.list(max_items=50):
print(jq.id, jq.name, jq.state)

anyscale.job_queue.status

Get the status and details for a specific job queue.

Arguments

  • job_queue_id (str): The unique ID of the job queue.

Returns: JobQueueStatus

Examples

import anyscale

status = anyscale.job_queue.status(job_queue_id="jobq_abc123")
print(status)

anyscale.job_queue.update

Update a job queue.

Arguments

  • job_queue_id (str | None) = None: ID of the job queue to update.
  • job_queue_name (str | None) = None: Name of the job queue to update (alternative to ID).
  • max_concurrency (int | None) = None: New maximum concurrency value.
  • idle_timeout_s (int | None) = None: New idle timeout in seconds.

Returns: JobQueueStatus

Examples

import anyscale

updated_jq = anyscale.job_queue.update(job_queue_id="jobq_abc123", max_concurrency=5)
print(updated_jq)

anyscale.job_queue.add_tags

Upsert tags for a job queue.

Arguments

  • job_queue_id (str | None) = None: ID of the job queue to tag (alternative to name).
  • name (str | None) = None: Name of the job queue to tag (alternative to ID).
  • tags (Dict[str, str]): Key/value tags to upsert as a map {key: value}.

Examples

import anyscale

anyscale.job_queue.add_tags(job_queue_id="jobq_abc123", tags={"team": "mlops"})

anyscale.job_queue.remove_tags

Remove tags by key from a job queue.

Arguments

  • job_queue_id (str | None) = None: ID of the job queue to modify (alternative to name).
  • name (str | None) = None: Name of the job queue to modify (alternative to ID).
  • keys (List[str]): List of tag keys to remove.

Examples

import anyscale

anyscale.job_queue.remove_tags(job_queue_id="jobq_abc123", keys=["team"])

anyscale.job_queue.list_tags

List tags for a job queue as a key/value mapping.

Arguments

  • job_queue_id (str | None) = None: ID of the job queue to read tags (alternative to name).
  • name (str | None) = None: Name of the job queue to read tags (alternative to ID).

Returns: Dict[str, str]

Examples

import anyscale

tags: dict[str, str] = anyscale.job_queue.list_tags(name="my-queue")

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

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

Examples

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.