Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

On Ares and Athena we cannot easily expose the GUI to external world, as calculations are done internally on a computing node, not visible from Internet.

Therefore, in ACC Cyfronet we have perepared start-vscode-web  script that can be used easliy with VSCode module. In this guide, we will explore how to use it 

to start VSCode web session. 

How to use on Ares?

Via SSH tunnel

The trick is to start VSCode webserver via a job submitted to a computing node and creating a SSH tunnel to access it on a local PC.

Submit

...

vscode-server job to a computing node

Create the following file:

Code Block
languagebash
titlerstudiovscode-server-notebooknode.slurm
#!/bin/bash
#SBATCH --partition plgrid
#SBATCH --nodes 1
#SBATCH --ntasks-per-node 6
#SBATCH --time 0:30:00
#SBATCH --job-name code-server
#SBATCH --output code-server-log-%J.txt

module load vscode/1.86.1

mkdir -p $SCRATCH/vscodedata

## start an rserver instance
start-vscode-web --server-data-dir $SCRATCH/vscodedata

...

  • PD - PENDING - Job is awaiting resource allocation.
  • R - RUNNING - Job currently has an allocation and is running.
  • CF - CONFIGURING  - Job has been allocated resources, but are waiting for them to become ready for use (e.g. booting). On Ares CF state could last for up to 8 minutes in case when nodes that have been in power save mode.
  • CG - COMPLETING  - Job is in the process of completing. Some processes on some nodes may still be active.

Make a tunnel

In your directory cat When the job will start, it will create a file named code-server-log-<jobID>.txt  in the folder from which the sbatch command was called. Go to this directory and use cat  to see the contents of VSCode log file:

Code Block
languagebash
cat code-server-log-XXXXXXX.txt

where `XXXXXXX` is your sbatch job id which is displayed after you run it f.e. `cat . For example, for the job with ID 7123485, the file name will be  code-server-log-7123485.txt`.

It will show you something like The output will look similar to this:

Code Block
languagebash
    Copy/Paste this in your local terminal to ssh tunnel with remote
    -----------------------------------------------------------------
    ssh -o ServerAliveInterval=300 -N -L 9633:172.22.17.186:9633 plguser@ares.cyfronet.pl
    -----------------------------------------------------------------
    Then use Web UI link located at the end of the log in your web browser:

*
* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*
Web UI available at http://localhost:9633?tkn=ee8e3c6e34ad22ea267a9532635cabe8d1b5fbc59b8705e91737a6129a866b5b

In the top we can see a command prepared for you to run in your local terminal.

Copy it and execute in your local terminalExec in another shell at your local computer given command to make a tunnel:

Code Block
languagebash
ssh -o ServerAliveInterval=300 -N -L 9633:172.22.17.186:9633 plguser@ares.cyfronet.pl

Note that in your case, the ports in the tunnel command will be different. Also, insted of plguser  your username will be displayed.

Start the

...

vscode web gui

Now, when the tunnel is running, you will need to open the link shown in the log file. Copy it and open it in your browser.

Open in browser: Web UI link from example log above: http://localhost:9633?tkn=ee8e3c6e34ad22ea267a9532635cabe8d1b5fbc59b8705e91737a6129a866b5b

Note that in your case, this URL will be different.

Preserve server data

To use preserve the same VSCode server data and VSCode environment, use option --server-data-dir with some location pointing at some directory of your choice. The location should be the same each time to save configuration. In this example, we have used  $SCRATCH/vscodedata is path as the storage location example.

Stop job

if you wish to to end your sbatch, use scancel <JOBID> command, where JOBID is your tunnel JOBID you can look it up with hpc-jobs or qsueue squeue -u $USER commands.

Code Block
scancel <JOBID>

...

To check submitted and running jobs use hpc-jobs or qsueue squeue -u $USER commands.

To check information about finished and historic jobs use hpc-jobs-history command. For example with option "-d 30"  that command shows all user's jobs from last 30 days. More info in hpc-jobs-history -h

Code Block
hpc-jobs-history -d 30

How to use on Athena?

On To use on Athena supercomputer the only change in script is name of the queue: , you need to change --partition  to plgrid-gpu-a100 and name of the module to load: VSCode/1.85.0.

Skrypt z tymi zmianami znajduje się poniżej:

Code Block
languagebash
titlevscode-server-node-Athena.slurm
#!/bin/bash
#SBATCH --partition plgrid-gpu-a100
#SBATCH --nodes 1
#SBATCH --ntasks-per-node 6
#SBATCH --time 0:30:00
#SBATCH --job-name code-server
#SBATCH --output code-server-log-%J.txt

module load VSCode/1.85.0

mkdir -p $SCRATCH/vscodedata

## start an rserver instance
start-vscode-web --server-data-dir $SCRATCH/vscodedata