This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
techstaff:aicluster [2020/12/10 12:55] kauffman |
techstaff:aicluster [2020/12/10 12:57] kauffman [Batch] |
||
---|---|---|---|
Line 152: | Line 152: | ||
===== Jupyter Notebook Tips ===== | ===== Jupyter Notebook Tips ===== | ||
+ | ==== Batch ==== | ||
+ | The process for a batch job is very similar. | ||
+ | jupyter-notebook.sbatch | ||
+ | <code> | ||
+ | #!/bin/bash | ||
+ | unset XDG_RUNTIME_DIR | ||
+ | NODEIP=$(hostname -i) | ||
+ | NODEPORT=$(( $RANDOM + 1024)) | ||
+ | echo "ssh command: ssh -N -L 8888:$NODEIP:$NODEPORT `whoami`@fe01.ai.cs.uchicago.edu" | ||
+ | . ~/myenv/bin/activate | ||
+ | jupyter-notebook --ip=$NODEIP --port=$NODEPORT --no-browser | ||
+ | </code> | ||
+ | |||
+ | Check the output of your job to find the ssh command to use when accessing your notebook. | ||
+ | |||
+ | Make a new ssh connection to tunnel your traffic. The format will be something like: | ||
+ | |||
+ | ''%%ssh -N -L 8888:###.###.###.###:#### user@fe01.ai.cs.uchicago.edu.edu%%'' | ||
+ | |||
+ | This command will appear to hang since we are using the -N option which tells ssh not to run any commands including a shell on the remote machine. | ||
+ | |||
+ | Open your local browser and visit: ''%%http://localhost:8888%%'' | ||
+ | ==== Interactive ==== | ||
- ''%%srun --pty bash%%'' run an interactive job | - ''%%srun --pty bash%%'' run an interactive job | ||
- ''%%unset XDG_RUNTIME_DIR%%'' jupyter tries to use the value of this environment variable to store some files, by defaut it is set to '' and that causes errors when trying to run juypter notebook. | - ''%%unset XDG_RUNTIME_DIR%%'' jupyter tries to use the value of this environment variable to store some files, by defaut it is set to '' and that causes errors when trying to run juypter notebook. |