Running VS Code Workspaces

Introduction

VS Code Workspaces may require at least 1GiB of free RAM. Read more.

End Goal

  • Submit and manage VS Code workspaces using the runai-bgu CLI.

  • Connect/disconnect/reconnect to your VS Code workspace with ease.

Submitting a VS Code Workspace

Example 1. Explicit resources
$ ssh bhn20 (1)
$ runai-bgu submit vscode \ (2)
  -n my-workspace \ (3)
  -c 2 \ (4)
  -m 4Gi \ (5)
  -g 0.1 \ (6)
1 Configure SSH connection to bhn20
2 Specifies it is a VS Code.
3 Specifies the name of the job.
4 Allocates 2 CPU cores.
5 Allocates 4GiB of memory*.
6 Specifies the GPU allocation(Whole or fractions). If you do not need GPU, do not use this flag.

You can also use a predefined resource template. Check out the guide for the template CLI Introduction.

Example 2. Using User Templates:
$ runai-bgu submit vscode \ (1)
  -n my-workspace (2)
  --ut workspace-user (3)
1 Submit a vscode workload
2 Specify the job name
3 Use the --ut specify the user template
Example 3. Using Group Templates:
$ runai-bgu submit vscode \ (1)
  -n my-workspace (2)
  --ug workspace-group  (3)
1 Submit a vscode workload
2 Specify the job name
3 Use the --ug specify the group template

Wait for Job to Start

The CLI will display messages about the job creation and port-forwarding status.

Example 4. Synopsis
Start job for remote development
$ ssh bhn20 (1)
$ runai-bgu submit vscode -n my-workspace --ut workspace (2)
Waiting for workload to appear...
Waiting for workload to run...
SSH workspace vscode is running. Setting up port forwarding to port <port-number>... (3)
1 Configure SSH connection to bhn20 manual.adoc[runai-bgu]
2 The port number is displayed in the terminal output after the SSH connection is established. Need to be set in the VSCode Remote Development setup.

Open VS Code and Connect

Open VS Code and click the remote icon on the bottom-left corner (highlighted in red in the following screenshot) and click Connect To Host…​.

vscode connet to host

Ending or Pausing Your Session

When you are done with your work or need to step away: When using workspaces the user has two choices when leaving the computer:

  1. Disconnect and delete the workspace: Use this method when the workspace is not necessary anymore and can be deleted.

    Example 5. Disconnect and delete workspace.

    In the terminal session where runai-bgu is running, type:

    $ stopall

    This will halt the port-forwarding and delete your workspace

  2. Background execution: Use this method when there is code running in the background/you are planning to return soon.

Keep in mind that if your workspace has GPUs allocated to it, the workspace will be deleted automatically after ~6 hours with no use of the GPU.
Example 6. Disconnect without deleting the job

In the terminal session where runai-bgu is running, type:

$ stop

This halts port-forwarding but keeps the job running.

Jobs in this state will be counted in you monthly bill.

Resuming your workspace

To resume your workspace, if the job is still running, re-do the steps from the submission command including the submission command.

If the job was stopped, you can resume it by running:

$ runai-bgu resume {job-name}

Then, re-do the steps from the submission command including the submission command.