e
Table of Contents |
---|
RStudio-Server Visual Studio Code is usually started on a localhost, which results in starting local webserver and using web browser application to interact with the web gui.
On Ares we Ares and Athena we cannot easily expose the web socket GUI to external world, as calculations are done internally on a computing node, not visible from Internet.
...
The trick is to start RStudio server VSCode webserver via a job submitted to a computing node and creating a SSH tunnel to access it on a local PC.
...
Code Block | ||||
---|---|---|---|---|
| ||||
#!/bin/bash #SBATCH --partition plgrid #SBATCH --nodes 1 #SBATCH --ntasks-per-node 6 #SBATCH --time 0:30:00 #SBATCH --job-name rstudiocode-server-tunnel #SBATCH --output rstudiocode-server-log-%J.txt ##module get tunneling info XDG_RUNTIME_DIR="" ipnport=$(shuf -i8000-9999 -n1) ipnip=$(hostname -i) user=$USER ## print tunneling instructions to rstudio-log-{jobid}.txt echo -e " Copy/Paste this in your local terminal to ssh tunnel with remote ----------------------------------------------------------------- ssh -o ServerAliveInterval=300 -N -L $ipnport:$ipnip:$ipnport ${user}@ares.cyfronet.pl ----------------------------------------------------------------- Then open a browser on your local machine to the following address ------------------------------------------------------------------ localhost:$ipnport (prefix w/ https:// if using password) ------------------------------------------------------------------ " module load rstudio-server/2022.12.0+353-foss-2021b-java-11-r-4.2.0 load vscode/20240129-insiders mkdir -p $SCRATCH/vscodedata ## start an rserver instance rserverstart-vscode-startweb --server-wwwdata-port $ipnport dir $SCRATCH/vscodedata |
Save it as rserveras vscode-run
.slurm
.
Send job to queue using sbatch
command on login node of Ares
Code Block | ||
---|---|---|
| ||
sbatch rservervscode-run.slurm |
Wait until your job enters running state.
...
In your directory cat rstudio VSCode log file:
Code Block | ||
---|---|---|
| ||
cat rstudiocode-server-log-XXXXXXX.txt |
where `XXXXXXX
` is your sbatch job id which is displayed after you run it f.e. `cat rstudiocode-server-log-7123485.txt
`
It will show you something like this:
Code Block | ||
---|---|---|
| ||
Copy/Paste this in your local terminal to ssh tunnel with remote ----------------------------------------------------------------- ssh -o ServerAliveInterval=300 -N -L 85119633:172.2022.6817.193186:85119633 plgusername@aresplguser@ares.cyfronet.pl ----------------------------------------------------------------- Then use openWeb aUI browserlink onlocated yourat localthe machineend toof the following address ------------------------------------------------------------------ localhost:8511 (prefix w/ https:// if using password) ------------------------------------------------------------------ ## You exec in another shell given command: > ssh -o ServerAliveInterval=300 -N -L 8511:172.20.68.193:8511 plgusername@ares.cyfronet.pl ## And you are set, you can open in browser: > `localhost:8511`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 |
Exec in another shell at your local computer given command to make a tunnel:
Code Block | ||
---|---|---|
| ||
ssh -o ServerAliveInterval=300 -N -L 85119633:172.2022.6817.193186:85119633 plgusername@aresplguser@ares.cyfronet.pl |
Open in browser: `localhost:8511
`Web UI link from log above: http://localhost:9633?tkn=ee8e3c6e34ad22ea267a9532635cabe8d1b5fbc59b8705e91737a6129a866b5b
Preserve server data
To use the same server data and VSCode environment, use option --server-data-dir
with some location. The location should be the same each time to save configuration. In this example $SCRATCH/vscodedata
is the location example.
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 -u $USER
commands.
...