#!/bin/bash
#SBATCH --job-name=jupyter_user_session
#SBATCH --nodes=1    # request a single compute node
#SBATCH --ntasks=1
#SBATCH --mem=0      # request all memory on the node 
#SBATCH --exclusive  # request exclusive access to the node
#SBATCH --time=01:00:00

source ~/miniforge3/bin/activate jupyter-user-env

# Add pre-installed kernelspecs to the Jupyter data search path
export JUPYTER_PATH="/tools/brics/jupyter/jupyter_data${JUPYTER_PATH:+:}${JUPYTER_PATH:-}"

HSN_FQDN="$(hostname).hsn.cm.i3.isambard.ac.uk"
LISTEN_IP=$(dig "${HSN_FQDN}" A +short | tail -n 1)
LISTEN_PORT=8888

set -o xtrace
jupyter lab --no-browser --ip="${LISTEN_IP}" --port="${LISTEN_PORT}"
