Skip to main content


There are 3 ways to develop on Anyscale.

  1. Ray Jobs (Recommended)
  2. Ray Client Interactive Session
  3. UI Development with Jupyter and Webterminal

This walkthrough describes how to use each of these tools to succeed on Anyscale.

Setup your environment

Install the latest ray and Anyscale

pip install ray
pip install -U anyscale

Clone the Anyscale Examples Repo.

git clone anyscale_doc_examples
cd anyscale_doc_examples

We will use from the examples repo in this guide.

Connecting to Anyscale

To submit workloads to Anyscale, configure your Ray Address Connection String to point to an Anyscale Cluster.

export RAY_ADDRESS=anyscale://example_cluster

Connecting to an existing cluster

If you already created a cluster in the UI, you can connect to it from your laptop. Find your cluster on the Clusters Page. Click the blue "Connect" button in the top right, click "Command Line", and paste the command in your terminal.

Connect to Anyscale It should be similar to the command below.

export RAY_ADDRESS=anyscale://project_name/cluster_name

Ray Jobs

Ray versions 1.11+ support Ray Jobs to support work from your laptop to a cluster. Make sure you set the --working-dir flag to upload your working directory to the cluster.

# Start a cluster, then run `python` on the cluster
$ ray job submit --working-dir="." -- python

Starting cluster example_cluster_2:
... [some logs omitted]

... [some logs omitted]
Hello World!

We have successfully run a Ray Job on Anyscale!

Logs for your job are persisted by Anyscale. They are automatically streamed to your laptop, and you can view them in the UI.

You can view your cluster in the UI by clicking the link in the output above. Ray Jobs appear under the "Interactive Sessions" tab in the UI.

Making changes

Let's make an edit to
import ray

def hello_world():
- return "Hello World!"
+ return "Hello Anyscale!"

result = ray.get(hello_world.remote())

Now when we resubmit the Job, it should reflect our changes.

# Start a cluster, then run `python` on the cluster
$ ray job submit --working-dir="." -- python

Starting cluster example_cluster_2:
... [some logs omitted]

... [some logs omitted]
Hello Anyscale!

That's it! To view more configuration options for Ray Jobs, please refer to the Ray Documentation.

Ray Client Interactive Sessions

Ray Client Interactive Sessions support running interactive ray workloads. The example below uses an IPython Notebook. Please install Jupyter to run it.

When using Ray Client, any code defined inside of a Ray Task or Actor will run on Anyscale. The main python script will be run on your local machine.

$ ipython
In [1]: import ray

In [2]: @ray.remote
...: def hello_world():
...: print("Hello World!")

In [3]: ray.get(hello_world.remote())
(hello_world pid=8652) Hello World!

That's it! The hello_world function runs remotely on Anyscale and streams logs back. You can also view this Interactive Session in the Anyscale UI on the Interactive Sessions page. For more information about how to use Ray Client, please refer to the Ray Documentation.

Jupyter and Webterminal

Anyscale provides Jupyter and Webterminal in the UI to provide a UI centric editing experience. To access these tools, first start a cluster. You can start a cluster in the UI on the Create Cluster Page. Once your cluster has started, find it in the Clusters Page.

You should see a terminal in the Terminal section of the page. Any command you run here will be run on the Anyscale Cluster. You can also click the Jupyter button in the top right to open a hosted Jupyter instance.


Why did my cluster terminate?

Anyscale clusters terminate after 120 minutes of inactivity. To change this default set the autosuspend keyword in the connection string to your preferred timeout in minutes. To disable autosuspend, set -1.

export RAY_ADDRESS=anyscale://example_cluster?autosuspend=-1&update=true

A cluster is considered active if there is a Ray Job, a Ray Client Interactive Session, or Webterminal command running on it. Crucially, commands run in hosted Jupyter will not prevent your cluster from timing out.