Skip to content

Run Jupyter Server

Saravanabalagi Ramachandran edited this page Mar 13, 2020 · 3 revisions

To start the jupyter server,

singularity run --app jupyter instance://jupyter 0,1

This jupyter server will use only GPUs 0 and 1. Change appropriately.

Checking running Servers, Tokens and Live Server Logs

singularity run --app jupyter_servers instance://jupyter         # To see running server and tokens
singularity run --app jupyter_logs instance://jupyter            # To connect to terminal to see live logs and to stop

jupyter_logs app will take you inside tmux (detached screen).

  • To switch tabs, use Ctrl+B, then N
  • To exit keeping it running in background, use Ctrl+B, then D
  • To stop jupyter server use Ctrl+C as you would do normally in any terminal
  • If you're in singularity's prompt Singularity jupyter.sif:~> you can exit it by executing exit in the prompt

Port Forwarding

You may want to edit the notebook remotely in your machine. To do so, start the jupyter notebook server using above instructions and run the following command in your machine:

ssh -NfL localhost:8000:localhost:8888 remote-machine.ip.address
#                     |           |
#   [desired local port]          [remote port where server is running]

Then run localhost:8000 in a browser on your machine to view/edit the notebooks. This command forwards the port 8000 in your machine to the server's port 8888.

Note

  • Jupyter app will create a temporary folder at ~/.container/jupyter (check CONTAINER_RUNTIME_DIR env variable in the definition file) or ~/.jupyter in the host machine (not inside the container!) where notebook tokens and other ephemeral information will be stored.

Clone this wiki locally