Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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