Quickstart: Launch Workspace with a Visual Studio Code for Web¶
Introduction¶
The purpose of this article is to provide a quick ramp-up to running a Workspace running Visual Studio Code (Web edition). Workspaces are containers that live forever until deleted by the user.
There are various ways to submit a Workspace:
- Run:ai command-line interface (CLI)
- Run:ai user interface
- Run:ai API
Prerequisites¶
To complete this Quickstart, the Infrastructure Administrator will need to configure a wildcard certificate to Run:ai as described here.
To complete this Quickstart, the Platform Administrator will need to provide you with:
- Researcher access to Project in Run:ai named "team-a"
- The project should be assigned a quota of at least 1 GPU.
- A URL of the Run:ai Console. E.g. https://acme.run.ai.
To complete this Quickstart via the CLI, you will need to have the Run:ai CLI installed on your machine. There are two available CLI variants:
- The older V1 CLI. See installation here
- A newer V2 CLI, supported with clusters of version 2.18 and up. See installation here
Step by Step Walkthrough¶
Login¶
Run runai login
and enter your credentials.
Run runai login
and enter your credentials.
Browse to the provided Run:ai user interface and log in with your credentials.
To use the API, you will need to obtain a token. Please follow the api authentication article.
Create a Visual Studio Environment¶
To complete this Quickstart via the UI, you will need to create a new Visual Studio Environment asset.
This is a one-time step for all VSCode Workloads.
Under Environments
Select NEW ENVIRONMENT. Then select:
- A scope (where you want your environment to live).
- Use the environment name
vscode
. - The image
quay.io/opendatahub-contrib/workbench-images:vscode-datascience-c9s-py311_2023c_latest
. - Under
Tools
, add Visual Studio Code and change the port to8787
.
Run Workload¶
Open a terminal and run:
Note
For more information on the workload submit command, see cli documentation.
Open a terminal and run:
runai project set team-a
runai workspace submit vs1 --image quay.io/opendatahub-contrib/workbench-images:vscode-datascience-c9s-py311_2023c_latest \
--gpu-devices-request 1 --external-url container=8787
Note
For more information on the workspace submit command, see cli documentation.
- In the Run:ai UI select Workloads
- Select New Workload and then Workspace
- You should already have
Cluster
,Project
and astart from scratch
Template
selected. Entervs1
as the name and press CONTINUE. - Under
Environment
, select select the previously createdvscode
environment. - Under
Compute Resource
, selectone-gpu
. - Select CREATE WORKSPACE.
Note
For more information on submitting Workloads and creating Assets via the user interface, see Workload documentation.
curl -L 'https://<COMPANY-URL>/api/v1/workloads/workspaces' \ # (1)
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>' \ # (2)
-d '{
"name": "vs1",
"projectId": "<PROJECT-ID>", '\ # (3)
"clusterId": "<CLUSTER-UUID>", \ # (4)
"spec": {
"image": "quay.io/opendatahub-contrib/workbench-images:vscode-datascience-c9s-py311_2023c_latest",
"compute": {
"gpuDevicesRequest": 1
},
"exposedUrls" : [
{
"container" : 8787,
"toolType": "visual-studio-code", \ # (5)
"toolName": "Visual Studio" \ # (6)
}
]
}
}'
<COMPANY-URL>
is the link to the Run:ai user interface. For exampleacme.run.ai
<TOKEN>
is an API access token. see above on how to obtain a valid token.<PROJECT-ID>
is the the ID of theteam-a
Project. You can get the Project ID via the Get Projects API<CLUSTER-UUID>
is the unique identifier of the Cluster. You can get the Cluster UUID by adding the "Cluster ID" column to the Clusters view.toolType
will show the Visual Studio icon when connecting to the Visual Studio tool via the user interface.toolName
text will show when connecting to the Visual Studio tool via the user interface.
Note
- The above API snippet will only work with Run:ai clusters of 2.18 and above. For older clusters, use, the now deprecated Cluster API.
- For more information on the Training Submit API see API Documentation
This would start a Workspace with a pre-configured Visual Studio Code image with an allocation of a single GPU.
Accessing Visual Studio Web¶
Via the Run:ai user interface, go to Workloads
, select the vs1
Workspace and press Connect
.
Stop Workload¶
Run the following: