Closed HenrikBengtsson closed 2 years ago
With the new rsc wait
(#36), the above can be replaced by:
#! /usr/bin/env bash
#SBATCH --nodes=1
## Port on submit host
port=${1:?}
host=${2:${SLURM_SUBMIT_HOST}}
[[ -z ${host} ]] && { echo &>2 "ERROR: Failed to infer host"; exit 1; }
module load CBI rstudio-server-controller
## Launch RStudio Server in the background
rsc start --port=random &
## Which port did rsc produce?
rsc_port=$(rsc wait | tail -1)
## SSH back to submit host opening up port via a reverse tunnel
ssh -N -R "${port}:localhost:${rsc_port}" "${host}"
A simpler interface would be
rsc start --port=random --reverse-tunnel="${SLURM_SUBMIT_HOST}:${port}"
Implemented prototypical support for:
rsc start --port=random --reverse-tunnel="${SLURM_SUBMIT_HOST}:${port}"
I've tested it on C4 and on Wynton, where it works.
Background
Submitting the following job script:
will make the RStudio Server available from the submit host on port 43211.
This is an interesting alternative that works when one cannot SSH to a compute node, but one can SSH from a compute node back to the submit host.
Suggestion
Add options to
rsc start
to launch that reverse SSH connection, e.g.