Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ariannarocchetti/1b656a376fd471122a62f0d9eda99ebd to your computer and use it in GitHub Desktop.
Save ariannarocchetti/1b656a376fd471122a62f0d9eda99ebd to your computer and use it in GitHub Desktop.
#!/bin/bash
#SBATCH --job-name=notebook
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=8
#SBATCH --mem-per-cpu=4480
#SBATCH --time=12:00:00
#SBATCH --account=pi-lgrandi
#SBATCH --partition=dali
#SBATCH --qos=dali
#SBATCH --output=logs/jupyter-log-%J.txt
#SBATCH --error=logs/jupyter-log-%J.txt
# Put your desired root directory here
cd ${HOME}
export PATH=/project/lgrandi/anaconda3/bin:$PATH
source activate pax_head
ipnport=$(shuf -i8000-9999 -n1)
ipnip=$(hostname -i)
## print tunneling instructions to jupyter-log-{jobid}.txt
echo -e "
Copy/Paste this in your local terminal to ssh tunnel with remote
-----------------------------------------------------------------
ssh -N -f -L $ipnport:$ipnip:$ipnport ${USER}@midway2.rcc.uchicago.edu
-----------------------------------------------------------------
Then open a browser on your local machine to the following address
------------------------------------------------------------------
localhost:$ipnport
------------------------------------------------------------------
and use the token that appears below to login.
OR replace "$ipnip" in the address below with "localhost" and copy
to your local browser.
"
jupyter-notebook --no-browser --port=$ipnport --ip=$ipnip 2>&1 | tee -a logs/jupyter-log-%J.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment