Skip to main content
Version: Canary 🐤

Create and manage jobs

Submitting a job

To submit your job to Anyscale, use the Python SDK or CLI and pass in any additional options or configurations for the job.

By default, Anyscale uses your workspace or cloud to provision a cluster to run your job. You can define a custom cluster through a compute config or specify an existing cluster.

Once submitted, Anyscale runs the job as specified in the entrypoint command, which is typically a Ray Job. If the run doesn't succeed, the job restarts using the same entrypoint up to the number of max_retries.

anyscale job submit --name=my-job \
--working-dir=. --max-retries=5 \
--image-uri="anyscale/image/IMAGE_NAME:VERSION" \
--compute-config=COMPUTE_CONFIG_NAME \
-- python

With the CLI, you can either specify an existing compute config with --compute-config=COMPUTE_CONFIG_NAME or define a new one in a job YAML.

For more information on submitting jobs with the CLI, see the reference docs.


For large-scale, compute-intensive jobs, avoid scheduling Ray tasks onto the head node because it manages cluster-level orchestration. To do that, set the CPU resource on the head node to 0 in your compute config.

Defining a job

With the CLI, you can define jobs in a YAML file and submit them by referencing the YAML:

anyscale job submit --config-file config.yaml

For an example of defining a job in a YAML, see the reference docs.

Waiting on a job

You can block CLI and SDK commands until a job enters a specified state. By default, JobState.SUCCEEDED is used. See all available states in the reference docs.

anyscale job wait -n job-wait

When you submit a job, you can specify --wait, which waits for the job to succeed or exits if the job fails.

anyscale job submit -n job-wait --wait -- sleep 30

For more information on submitting jobs with the CLI, see the reference docs.

Terminating a job

You can terminate a job from the Job page or using the CLI/SDK:

anyscale job terminate --id 'prodjob_...'

For more information on terminating jobs with the CLI, see the reference docs.

Archiving a job

Archiving jobs hide them from the job list page, but you can still access them through the CLI and SDK. The cluster associated with an archived job is archived automatically.

To be archived, jobs must be in a terminal state. You must have created the job or be an organization admin to archive the job.

You can archive jobs in Anyscale console or through the CLI/SDK:

anyscale job archive --id 'prodjob_...'

For more information on archiving jobs with the CLI, see the reference docs.