Tunneling HTTP for Jupyter
With this method, the application runs a small web server to which you connect with your web browser. This can be especially useful for launching Jupyter notebooks from the HPC/batch clusters.
Generally these applications assume that both the application's web server and the web browser will be running on the same computer. Since this will not be the case (the server will be running in an interactive job on a compute node, while the browser will be on the computer in front of you), we need to make a few adjustments:
- If the application attempts to automatically open a web browser, ask it not to. With Jupyter Notebook, this is
--no-browser
. - Instruct the application to listen for connections from other computers, not just the one it's running on. Again with Jupyter Notebook, this is
--ip=\*
.
To launch a jupyter notebook, please use the shared memory/serial clusters (gust, gulf, astral or hima):
11 [gust] salloc -N1 -n4 -t 1:00:00
salloc: Granted job allocation 45807
salloc: Nodes gt01 are ready for job
12 [gt01] jupyter-notebook --no-browser --ip=\*
[C 11:38:56.480 NotebookApp] ... Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://localhost:8888/?token=39ff...26fe
Port forward from on campus:
Now that we have a URL, leave the application running and open a new terminal on the computer in front of you. Make the URL valid on the computer in front of you by having SSH forward port 8888
(from the URL) to gt01(from the prompt):
ssh -NL 8888:gt01:8888 user@gust.sciclone.wm.edu
Leaving that open, you should then be able to open the URL in your web browser. This command will not exit and should just appear to 'hang' (which also makes it easier to identify which window is doing the forwarding so you can kill it when your Jupyter session is done).
Port forward from off campus:
A similar command-line can be used from off campus:
ssh -NL 8888:gt01:8888 -J user@bastion.wm.edu user@gust.sciclone.wm.edu