Versions Compared

Key

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

...

Code Block
languagebash
titlevscode-server-node.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


ln -s $TMPDIR  /tmp/${SLURM_JOB_ID}
export TMPDIR=/tmp/${SLURM_JOB_ID}

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

...

To preserve the VSCode server data and VSCode environment, use the option --server-data-dir 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 path as the storage location.

Stop job

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

...

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

ln -s $TMPDIR  /tmp/${SLURM_JOB_ID}
export TMPDIR=/tmp/${SLURM_JOB_ID}


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

An alternative approach - remote tunnels

Another way to use the VSCode remotely on the cluster is via a tunnel with a standard desktop GUI. Using this approach is similar with the one for setting up web browser access.

Installing Remote Tunnels extension

To begin with, we need to install the extension