Skip to content

Commit d1c9a98

Browse files
committed
anyscale getting started
Signed-off-by: Max Pumperla <[email protected]>
1 parent a29dc88 commit d1c9a98

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3572
-0
lines changed

_toc.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,24 @@ parts:
8888
- file: courses/01_examples/output/04_Ray_Train_distributed_training_04.ipynb
8989
- file: courses/01_examples/output/04_Ray_Train_distributed_training_05.ipynb
9090
- file: courses/01_examples/output/04_Ray_Train_distributed_training_06.ipynb
91+
- caption: Gettingstarted
92+
chapters:
93+
- file: courses/GettingStarted/output/101_01_anyscale_intro_workspace_01.ipynb
94+
- file: courses/GettingStarted/output/101_02_anyscale_development_intro_01.ipynb
95+
- file: courses/GettingStarted/output/101_03_anyscale_compute_runtime_intro_01.ipynb
96+
- file: courses/GettingStarted/output/101_04_anyscale_storage_options_01.ipynb
97+
- file: courses/GettingStarted/output/101_05_anyscale_logging_metrics_01.ipynb
98+
- file: courses/GettingStarted/output/101_06_anyscale_intro_jobs_01.ipynb
99+
- file: courses/GettingStarted/output/101_07_anyscale_intro_services_01.ipynb
100+
- file: courses/GettingStarted/output/101_08_anyscale_collaboration_01.ipynb
101+
- file: courses/GettingStarted/output/101_09_anyscale_org_setup_01.ipynb
102+
- file: courses/GettingStarted/output/101_09_anyscale_org_setup_02.ipynb
103+
- file: courses/GettingStarted/output/101_09_anyscale_org_setup_03.ipynb
104+
- file: courses/GettingStarted/output/101_anyscale_intro_jobs_01.ipynb
105+
- file: courses/GettingStarted/output/101_anyscale_intro_jobs_02.ipynb
106+
- file: courses/GettingStarted/output/101_anyscale_intro_jobs_03.ipynb
107+
- file: courses/GettingStarted/output/101_anyscale_intro_services_01.ipynb
108+
- file: courses/GettingStarted/output/101_anyscale_intro_services_02.ipynb
91109
- caption: Anyscale 101
92110
chapters:
93111
- file: courses/anyscale_101/output/101_anyscale_intro_jobs_01.ipynb
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"## 101 — Introduction to Anyscale Workspaces\n",
8+
"\n",
9+
"Anyscale Workspaces is a fully managed development environment for users to build applications on top of Ray. Anyscale Workspaces handles the heavy lifting by managing the compute resources, environment dependencies, storage, and IDE integration, allowing developers to rapidly iterate. "
10+
]
11+
},
12+
{
13+
"cell_type": "markdown",
14+
"metadata": {},
15+
"source": [
16+
"In this notebook, we will cover the following:\n",
17+
"\n",
18+
"- What Anyscale Workspaces are and how they simplify Ray development \n",
19+
"- How to launch and configure your own Workspace "
20+
]
21+
},
22+
{
23+
"cell_type": "markdown",
24+
"metadata": {},
25+
"source": [
26+
"### Launching a Anyscale Workspace\n",
27+
"\n",
28+
"Anyscale can connect with any Cloud (or on-prem) environment. For this workshop, click on the cloud selection and select **Anyscale Cloud** (Anyscale will host the compute).\n",
29+
"\n",
30+
"\n",
31+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/workspace1.png\" width=\"500\"/>\n",
32+
"\n",
33+
"\n",
34+
"Next, head over to workspace tab and click **Create > Create from Blank Workspace** to configure a new Anyscale Workspace. Click Continue.\n",
35+
"\n",
36+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/workspace2.png\" width=\"500\"/>\n",
37+
"\n",
38+
"<p>&nbsp;</p>\n",
39+
"\n",
40+
"You’ll be prompted with a screen to configure the Anyscale Workspace. Give your Workspace a name and choose the **default Container Image**. \n",
41+
"\n",
42+
"This defines the runtime environment for your Ray application, ensuring consistency by specifying the Ray version and the exact set of preinstalled libraries and their versions.\n",
43+
"\n",
44+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/workspace3.png\" width=\"500\"/>\n"
45+
]
46+
},
47+
{
48+
"cell_type": "markdown",
49+
"metadata": {},
50+
"source": [
51+
"In the **Compute Configuration,** leave the head node as default. \n",
52+
"\n",
53+
"For the **Worker Nodes**, add a custom node group. These machines will run your Ray application, so choose the instance types and sizes (CPU or GPU) based on the needs of your workflow.\n",
54+
"\n",
55+
"Select the smallest availiable CPU instance.\n",
56+
"\n",
57+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/workspace4.png\" width=\"600\"/>"
58+
]
59+
},
60+
{
61+
"cell_type": "markdown",
62+
"metadata": {},
63+
"source": [
64+
"Most workflows experience periods of bursty or spiky demand, Anyscale has the ability to autoscale Ray Clusters. Set the minimum number of nodes to 0 and the maximum node size to 2 in order to allow the cluster to autoscale based on workload.\n",
65+
"\n",
66+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/workspace7.png\" width=\"500\"/>"
67+
]
68+
},
69+
{
70+
"cell_type": "markdown",
71+
"metadata": {},
72+
"source": [
73+
"Glance through the additional settings before clicking Create to create the workspace. In a few minutes, your Anyscale Workspace will be active and ready to go.\n",
74+
"\n",
75+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/workspace5.png\" width=\"700\"/>"
76+
]
77+
}
78+
],
79+
"metadata": {
80+
"language_info": {
81+
"name": "python"
82+
}
83+
},
84+
"nbformat": 4,
85+
"nbformat_minor": 2
86+
}
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"## 101 -- Developing Application with Anyscale \n",
8+
"\n",
9+
"### Introduction\n",
10+
"\n",
11+
"As introduced in the previous section, the Anyscale Workspace provides a feature rich development environment without the overhead of managing infrastructure. In this section, we’ll walk through a few different ways to develop applications within the Anyscale Workspace.\n",
12+
"\n",
13+
"- **Using the built-in VSCode Editor** to write and execute Ray applications directly in the browser \n",
14+
"- **Running interactive notebooks in JupyterLab** for exploration and rapid prototyping \n",
15+
"- **Connecting from a local IDE (e.g. VSCode, Cursor)** to develop locally while running code on remote Anyscale compute \n",
16+
"- **Using the Anyscale CLI** to sync code, submit scripts, and automate tasks \n"
17+
]
18+
},
19+
{
20+
"cell_type": "markdown",
21+
"metadata": {},
22+
"source": [
23+
"### VSCode\n",
24+
"\n",
25+
"One of the fastest ways to begin developing with Anyscale is to use the hosted Visual Studio Code Editor that is already running on your Anyscale Workspace. Create or open an existing **Anyscale Workspace**.\n",
26+
"\n",
27+
"\n",
28+
"After your Anyscale Workspace is started, click on the VSCode icon. This will load a new web browser window and you can start developing right away.\n",
29+
"\n",
30+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/development1.png\" width=\"600\"/>\n",
31+
"\n",
32+
"\n",
33+
"Create a new file: `hello_world.py`\n",
34+
"\n",
35+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/development2.png\" width=\"400\"/>\n",
36+
"\n",
37+
"\n",
38+
"Let’s add a simple Ray example, copy and paste the code snippet below to `hello_world.py` "
39+
]
40+
},
41+
{
42+
"cell_type": "code",
43+
"execution_count": null,
44+
"metadata": {},
45+
"outputs": [],
46+
"source": [
47+
"import ray\n",
48+
"\n",
49+
"@ray.remote\n",
50+
"def hello_world():\n",
51+
" return \"Hello World!\"\n",
52+
"\n",
53+
"result = ray.get(hello_world.remote())\n",
54+
"print(result)"
55+
]
56+
},
57+
{
58+
"cell_type": "markdown",
59+
"metadata": {},
60+
"source": [
61+
"To submit and run the Ray Application on the Anyscale Cluster, just click the Play icon in the upper-right corner of VSCode.\n",
62+
"\n",
63+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/development3.png\" width=\"800\"/>\n",
64+
"\n",
65+
"\n",
66+
"The Anyscale Workspace includes built-in tools to help you monitor, debug, and troubleshoot your application after it’s been submitted, including access to logs, metrics, and the Ray Dashboard. We’ll cover this in a later tutorial."
67+
]
68+
},
69+
{
70+
"cell_type": "markdown",
71+
"metadata": {},
72+
"source": [
73+
"### Notebook\n",
74+
"\n",
75+
"In addition to VS Code, the **Anyscale Workspace** also includes a built-in JupyterLab environment for interactive development and data exploration.\n",
76+
"\n",
77+
"In the VSCode Tab, click the dropdown and select JupyterLab.\n",
78+
"\n",
79+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/development5.png\" width=\"600\"/>\n",
80+
"\n",
81+
"Once you have the JupyterLab notebook open, you can create a new file and start using Ray right away. Let’s create a `hello_world.ipynb` file by clicking on the new notebook button.\n",
82+
"\n",
83+
"- A Python notebook is an interactive document that lets you write and run code in cells, making it ideal for experimenting.\n",
84+
"\n",
85+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/development6.png\" width=\"600\"/>\n",
86+
"\n",
87+
"\n",
88+
"You can rename the file by right clicking on the filename `untitled.ipynb` in the left column of the screen.\n",
89+
"\n",
90+
"In a Notebook Cell, copy and Paste the code below. Run the Cell (Shift + Enter or Play Button)\n"
91+
]
92+
},
93+
{
94+
"cell_type": "code",
95+
"execution_count": null,
96+
"metadata": {},
97+
"outputs": [],
98+
"source": [
99+
"import ray\n",
100+
"\n",
101+
"@ray.remote\n",
102+
"def hello_world():\n",
103+
" return \"Hello World!\"\n",
104+
"\n",
105+
"result = ray.get(hello_world.remote())\n",
106+
"print(result)"
107+
]
108+
},
109+
{
110+
"cell_type": "markdown",
111+
"metadata": {},
112+
"source": [
113+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/development7.png\" width=\"800\"/>\n",
114+
"\n",
115+
"\n",
116+
"Now you can get instant feedback from your code, edit cells, re-run them, and quickly iterate as you experiment and explore."
117+
]
118+
},
119+
{
120+
"cell_type": "markdown",
121+
"metadata": {},
122+
"source": [
123+
"### Local IDE (VSCode / Cursor)\n",
124+
"\n",
125+
"If you prefer to use an IDE other than VS Code or JupyterLab, you can still use Anyscale Workspaces as part of your local development workflow. Develop and test code locally in your preferred environment, then run it remotely. \n",
126+
"\n",
127+
"In this section, we’ll make extensive use of the Anyscale Workspace CLI. For a complete list of available commands and their capabilities, refer to the [official documentation](https://docs.anyscale.com/reference/workspaces).\n",
128+
"\n",
129+
"Navigate to the IDE Dropdown and choose to open remotely on **VSCode Desktop (Local).** You will then be prompted to install the **Workspaces Extension.**\n",
130+
"\n",
131+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/development8.png\" width=\"400\"/>\n",
132+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/development9.png\" width=\"600\"/>\n",
133+
"\n",
134+
"\n",
135+
"Additional Pre-reqs:\n",
136+
"\n",
137+
"- You will want to make sure that you have the latest Anyscale CLI installed locally. This can be done via `pip install anyscale --upgrade`\n",
138+
"- You will need to be [authenticated](https://docs.anyscale.com/administration/organization/user-auth/#platform-api-keys) to Anyscale from your terminal. This can be done by running `anyscale login`\n",
139+
"- You will need your Workspace in a Running state. You can start a Workspace from the Anyscale Console, or by running the following [Anyscale CLI command](https://docs.anyscale.com/reference/workspaces/#anyscale-workspace_v2-start).\n",
140+
"\n",
141+
"`anyscale workspace_v2 start --name my-workspace`\n",
142+
"\n",
143+
"\n",
144+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/development10.png\" width=\"800\"/>\n",
145+
"\n",
146+
"\n",
147+
"Replace my-workspace with the name of your Workspace. All the following commands will expect the Workspace to be Running.\n",
148+
"\n",
149+
"To begin developing locally, start by **pulling a Anyscale Workspace** to your machine. This command downloads the Workspace’s working directory by creating new files and overwriting any existing ones in the specified local folder.\n",
150+
"\n",
151+
"\n",
152+
"Run in command line, replace my-workspace with the name of your Workspace\n",
153+
"\n",
154+
"`anyscale workspace_v2 pull --name my-workspace`\n",
155+
"\n",
156+
"- [Pull Command Documentation](https://docs.anyscale.com/reference/workspaces#anyscale-workspace_v2-pull)\n",
157+
"\n",
158+
"When you're ready to execute your Python file (like the `hello_world.py` script created earlier) on the Workspace cluster, use the following command. Replace the placeholder python filename and workspace name. \n",
159+
"\n",
160+
"`anyscale workspace_v2 run_command --name my-workspace \"python script.py\"`\n",
161+
"\n",
162+
"<img src=\"https://lz-public-demo.s3.us-east-1.amazonaws.com/anyscale101/development11.png\" width=\"800\"/>\n",
163+
"\n",
164+
"Now your Python script is running on the cluster associated with the specified Anyscale Workspace. It will automatically push the files prior to running so there is no need to push the files beforehand. You do not need to install any dependencies locally because the execution of the command runs remotely on the cluster container."
165+
]
166+
}
167+
],
168+
"metadata": {
169+
"language_info": {
170+
"name": "python"
171+
}
172+
},
173+
"nbformat": 4,
174+
"nbformat_minor": 2
175+
}

0 commit comments

Comments
 (0)