Skip to content

Instantly share code, notes, and snippets.

@hiraksarkar
Created September 9, 2023 16:54

Revisions

  1. hiraksarkar created this gist Sep 9, 2023.
    39 changes: 39 additions & 0 deletions della_princeton_jupyter_slurm.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    #!/bin/bash
    #SBATCH --mincpus 16
    #SBATCH --mem 64G
    #SBATCH --time 5:00:00
    #SBATCH --job-name mendel
    #SBATCH --mail-type=begin # send email when job begins
    #SBATCH --mail-type=end # send email when job ends
    #SBATCH --mail-user=hs0424@princeton.edu
    #SBATCH --output jupyter_logs/jupyter-notebook-%J.log
    # get tunneling info
    XDG_RUNTIME_DIR=""
    port=$(shuf -i10001-20000 -n1)
    node=$(hostname -s)
    user=$(whoami)
    cluster="della"
    # print tunneling instructions jupyter-log
    echo -e "
    MacOS or linux terminal command to create your ssh tunnel
    ssh -N -L ${port}:${node}:${port} ${user}@${cluster}.princeton.edu
    Windows MobaXterm info
    Forwarded port:same as remote port
    Remote server: ${node}
    Remote port: ${port}
    SSH server: ${cluster}.cs.princeton.edu
    SSH login: $user
    SSH port: 22
    Use a Browser on your local machine to go to:
    localhost:${port} (prefix w/ https:// if using password)
    "
    # load modules or conda environments here
    # uncomment the following two lines to use your conda environment called notebook_env
    source /scratch/gpfs/KANG/hirak/mambaforge/bin/activate base
    conda activate r42
    # conda activate spagcn
    # conda activate py-stagate
    cd /scratch/gpfs/KANG/hirak/mendel/Projects/neuroblastoma_analysis/notebook
    # DON'T USE ADDRESS BELOW.
    # DO USE TOKEN BELOW
    jupyter lab --no-browser --port=${port} --ip=${node}