From 73332a178bb256ee45fc7b2ecce1bf168f81e340 Mon Sep 17 00:00:00 2001 From: lauraporta <29216006+lauraporta@users.noreply.github.com> Date: Fri, 20 Jun 2025 14:46:15 +0100 Subject: [PATCH 01/15] Add draft guide --- docs/source/programming/port-fowarding.md | 186 ++++++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 docs/source/programming/port-fowarding.md diff --git a/docs/source/programming/port-fowarding.md b/docs/source/programming/port-fowarding.md new file mode 100644 index 0000000..6496008 --- /dev/null +++ b/docs/source/programming/port-fowarding.md @@ -0,0 +1,186 @@ +# Port Forwarding for Jupyter and HPC Jobs + +This guide explains how to securely and effectively forward ports from a compute node on the SWC HPC cluster to your local machine, enabling access to services like Jupyter Lab. This is particularly useful when `code tunnel` is unreliable or you prefer using a terminal-based workflow. + +Port forwarding allows you to interact with services running on a compute node (e.g., a Jupyter server on port 8082) from your browser or other tools on your laptop. + +## Overview + +The technique described below **does not involve SSHing into unallocated nodes**, which could interfere with other users or violate HPC usage policies. Instead, you'll **only access a node you've been assigned by SLURM**, and will **forward ports from that node to your laptop**, enabling tools like Jupyter Lab to work as expected without disconnection issues. + +--- + +## Step-by-step Instructions + +### 1. Connect to the cluster and request an interactive job + +```bash +ssh @ssh.swc.ucl.ac.uk +ssh hpc-gw2 +``` + +Then request a SLURM interactive job. For example: + +```bash +srun --nodes=1 --ntasks-per-node=1 --cpus-per-task=8 -p a100 --gres=gpu:1 --time=96:00:00 --mem=41G --pty bash -i +``` + +This will assign you a compute node and give you an interactive shell there. + +--- + +### 2. Set up and launch Jupyter Lab + +On the assigned node, activate your environment and navigate to your project folder: + +```bash +pyenv activate my_venv_3115 +cd /path/to/your/project +``` + +Then launch Jupyter Lab, specifying a port (e.g., 8082) and disabling the browser: + +```bash +jupyter lab --no-browser --port=8082 +``` + +Jupyter will start and display a link with a token. + +--- + +### 3. Forward the port from the compute node to your local machine + +On **your local machine**, open a separate terminal and run: + +```bash +ssh -L 8082:localhost:8082 +``` + +Replace `` with the actual name of the compute node assigned to you (e.g., `gpu-sr670-20`). This command establishes a secure tunnel between your laptop and the node. + +Then, **in your browser**, go to: + +``` +http://localhost:8082 +``` + +Paste in the token provided by the `jupyter lab` output. + +--- + +### 4. Notes on usage and cluster rules + +This method **respects cluster usage policies** because: + +- You are only SSHing into a node **you were explicitly allocated by SLURM**. +- The port forwarding (`ssh -L`) only gives you access to services running **on the localhost of that node**, not to shared resources. + +:::note +Using `ssh -L` on an allocated node is generally considered safe, as long as you're not trying to bypass SLURM's resource management or share your access with others. +::: + +--- + +## When to use this method + +You may prefer this method when: + +- `code tunnel` times out frequently or becomes unreliable. +- You don't need a full GUI like VSCode but still want access to Jupyter or HTTP apps. +- You're comfortable with the command line and prefer manual control over your environment. + +--- + +## Troubleshooting + +- **Jupyter not accessible at `localhost:8082`?** Make sure the ports match exactly in both commands. +- **Timeouts or connection drops?** Ensure you're using the assigned node and haven't closed the original SLURM session. +- **Port already in use?** Try another port like `8888`, `8090`, etc., just remember to update both commands. + +--- + +## Complementary tools + +If you prefer a fully integrated development environment and are okay with occasional tunnel issues, see our guide on: + +[Using VSCode with Interactive SLURM Jobs →](./vscode-tunnel.md) + +--- + +## Examples for Other Web Applications + +### Dash Applications + +For Dash applications, you can follow the same port forwarding approach: + +1. **On the compute node**, launch your Dash app with a specific port: + +```bash +python app.py +``` + +Where your `app.py` contains: + +```python +from dash import Dash, html, dcc +import dash_bootstrap_components as dbc + +app = Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP]) + +app.layout = html.Div([ + html.H1("My Dash App"), + dcc.Graph(id='example-graph') +]) + +if __name__ == '__main__': + app.run_server(debug=False, host='0.0.0.0', port=8050) +``` + +2. **On your local machine**, forward the port: + +```bash +ssh -L 8050:localhost:8050 +``` + +3. **Access your app** at `http://localhost:8050` + +### Streamlit Applications + +For Streamlit applications: + +1. **On the compute node**, launch Streamlit with a specific port: + +```bash +streamlit run app.py --server.port 8501 --server.address 0.0.0.0 +``` + +2. **On your local machine**, forward the port: + +```bash +ssh -L 8501:localhost:8501 +``` + +3. **Access your app** at `http://localhost:8501` + +### Flask/FastAPI Applications + +For Flask or FastAPI applications: + +1. **On the compute node**, launch your app: + +```bash +# For Flask +python app.py + +# For FastAPI +uvicorn main:app --host 0.0.0.0 --port 8000 +``` + +2. **On your local machine**, forward the port: + +```bash +ssh -L 8000:localhost:8000 +``` + +3. **Access your app** at `http://localhost:8000` + From 4162551d95cde25c3177db2715804a88b612278c Mon Sep 17 00:00:00 2001 From: lauraporta <29216006+lauraporta@users.noreply.github.com> Date: Fri, 20 Jun 2025 14:48:39 +0100 Subject: [PATCH 02/15] Add missing link from the idex --- docs/source/programming/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/programming/index.md b/docs/source/programming/index.md index c102202..c943af9 100644 --- a/docs/source/programming/index.md +++ b/docs/source/programming/index.md @@ -15,4 +15,5 @@ Mount-ceph-ubuntu Mount-ceph-ubuntu-temp Cookiecutter-cruft Troubleshooting +port-fowarding ``` From ab77efbf4d0b68c1b6ca2a8fbaf7df6f78faf5d6 Mon Sep 17 00:00:00 2001 From: lauraporta <29216006+lauraporta@users.noreply.github.com> Date: Thu, 3 Jul 2025 14:43:51 +0100 Subject: [PATCH 03/15] Update indications on port fowarding in the code tunnel tutorial --- docs/source/programming/vscode-with-slurm-job.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/source/programming/vscode-with-slurm-job.md b/docs/source/programming/vscode-with-slurm-job.md index f3db1e5..a855776 100644 --- a/docs/source/programming/vscode-with-slurm-job.md +++ b/docs/source/programming/vscode-with-slurm-job.md @@ -69,9 +69,10 @@ As explained in [VSCode docs](https://code.visualstudio.com/docs/remote/tunnels) ## Additional benefits of code tunnel -One advantage of using VSCode's code tunnel is that it forwards any HTTP servers launched from the same node, such as Dash-Plotly apps or Jupyter Notebook servers. To launch your additional server, request a separate slurm job for the same compute node, e.g.: +One advantage of using VSCode's code tunnel is that it automatically detects any HTTP servers you launch from the same node (such as Dash-Plotly apps or Jupyter Notebook servers) and shows them in the "Ports" view. Make sure to launch your server inside your compute node, for example by running: ```{code-block} console -$ srun -p cpu -w -n 4 --mem 8G --pty bash -i +$ jupyter notebook ``` -When these are initiated, VSCode will notify you with a link that you can follow to access the server's UI directly. + +You can then open the forwarded address from the Ports view in your browser or copy it. By default, forwarded ports are private and require GitHub authentication; to make a port public (no sign-in required), right-click the port and select "Port Visibility > Public." For more details, see the [VSCode port forwarding documentation](https://code.visualstudio.com/docs/debugtest/port-forwarding). From 717cd789468e078d1973cddb801ff5ac0619d343 Mon Sep 17 00:00:00 2001 From: lauraporta <29216006+lauraporta@users.noreply.github.com> Date: Thu, 3 Jul 2025 14:44:08 +0100 Subject: [PATCH 04/15] Update port fowarding tutorial --- docs/source/programming/port-fowarding.md | 44 ++++++++--------------- 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/docs/source/programming/port-fowarding.md b/docs/source/programming/port-fowarding.md index 6496008..bd6ac0b 100644 --- a/docs/source/programming/port-fowarding.md +++ b/docs/source/programming/port-fowarding.md @@ -22,10 +22,10 @@ ssh hpc-gw2 Then request a SLURM interactive job. For example: ```bash -srun --nodes=1 --ntasks-per-node=1 --cpus-per-task=8 -p a100 --gres=gpu:1 --time=96:00:00 --mem=41G --pty bash -i +srun -p gpu --gres=gpu:1 --mem=16G --pty bash -i ``` -This will assign you a compute node and give you an interactive shell there. +This will assign you a compute node using one GPU and give you an interactive shell there. --- @@ -53,7 +53,7 @@ Jupyter will start and display a link with a token. On **your local machine**, open a separate terminal and run: ```bash -ssh -L 8082:localhost:8082 +ssh -N @ -J @ssh.swc.ucl.ac.uk,@ -L 8082:localhost:8082 ``` Replace `` with the actual name of the compute node assigned to you (e.g., `gpu-sr670-20`). This command establishes a secure tunnel between your laptop and the node. @@ -103,7 +103,7 @@ You may prefer this method when: If you prefer a fully integrated development environment and are okay with occasional tunnel issues, see our guide on: -[Using VSCode with Interactive SLURM Jobs →](./vscode-tunnel.md) +[Using VSCode with Interactive SLURM Jobs →](./vscode-with-slurm-job.md) --- @@ -113,7 +113,7 @@ If you prefer a fully integrated development environment and are okay with occas For Dash applications, you can follow the same port forwarding approach: -1. **On the compute node**, launch your Dash app with a specific port: +**On the compute node**, launch your Dash app with a specific port: ```bash python app.py @@ -136,37 +136,32 @@ if __name__ == '__main__': app.run_server(debug=False, host='0.0.0.0', port=8050) ``` -2. **On your local machine**, forward the port: - -```bash -ssh -L 8050:localhost:8050 -``` - -3. **Access your app** at `http://localhost:8050` ### Streamlit Applications For Streamlit applications: -1. **On the compute node**, launch Streamlit with a specific port: +```python +import streamlit as st -```bash -streamlit run app.py --server.port 8501 --server.address 0.0.0.0 -``` +st.title("My Streamlit App") +st.write("This is a simple Streamlit app.") -2. **On your local machine**, forward the port: +if __name__ == "__main__": + st.run() +``` +**On the compute node**, launch Streamlit with a specific port: ```bash -ssh -L 8501:localhost:8501 +streamlit run app.py --server.port 8501 --server.address 0.0.0.0 ``` -3. **Access your app** at `http://localhost:8501` ### Flask/FastAPI Applications For Flask or FastAPI applications: -1. **On the compute node**, launch your app: +**On the compute node**, launch your app: ```bash # For Flask @@ -175,12 +170,3 @@ python app.py # For FastAPI uvicorn main:app --host 0.0.0.0 --port 8000 ``` - -2. **On your local machine**, forward the port: - -```bash -ssh -L 8000:localhost:8000 -``` - -3. **Access your app** at `http://localhost:8000` - From 3f61d9689c6a48ad93192589386ae2d1baeca44d Mon Sep 17 00:00:00 2001 From: lauraporta <29216006+lauraporta@users.noreply.github.com> Date: Thu, 3 Jul 2025 14:53:15 +0100 Subject: [PATCH 05/15] Remove flask example --- docs/source/programming/port-fowarding.md | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/docs/source/programming/port-fowarding.md b/docs/source/programming/port-fowarding.md index bd6ac0b..5288b75 100644 --- a/docs/source/programming/port-fowarding.md +++ b/docs/source/programming/port-fowarding.md @@ -107,7 +107,7 @@ If you prefer a fully integrated development environment and are okay with occas --- -## Examples for Other Web Applications +## Examples of Other Web Applications ### Dash Applications @@ -156,17 +156,3 @@ if __name__ == "__main__": streamlit run app.py --server.port 8501 --server.address 0.0.0.0 ``` - -### Flask/FastAPI Applications - -For Flask or FastAPI applications: - -**On the compute node**, launch your app: - -```bash -# For Flask -python app.py - -# For FastAPI -uvicorn main:app --host 0.0.0.0 --port 8000 -``` From 9709209f54f7368a8b02edd58e2e42d4112007b9 Mon Sep 17 00:00:00 2001 From: lauraporta <29216006+lauraporta@users.noreply.github.com> Date: Thu, 3 Jul 2025 14:54:01 +0100 Subject: [PATCH 06/15] Change title --- docs/source/programming/vscode-with-slurm-job.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/programming/vscode-with-slurm-job.md b/docs/source/programming/vscode-with-slurm-job.md index a855776..7b18232 100644 --- a/docs/source/programming/vscode-with-slurm-job.md +++ b/docs/source/programming/vscode-with-slurm-job.md @@ -67,7 +67,7 @@ As explained in [VSCode docs](https://code.visualstudio.com/docs/remote/tunnels) >Once you connect from a remote VS Code instance, an SSH connection is created over the tunnel in order to provide end-to-end encryption. ::: -## Additional benefits of code tunnel +## Port forwarding One advantage of using VSCode's code tunnel is that it automatically detects any HTTP servers you launch from the same node (such as Dash-Plotly apps or Jupyter Notebook servers) and shows them in the "Ports" view. Make sure to launch your server inside your compute node, for example by running: From 4cccabbf7d97ec9c85a009e2f04a9722f0de4db6 Mon Sep 17 00:00:00 2001 From: lauraporta <29216006+lauraporta@users.noreply.github.com> Date: Thu, 3 Jul 2025 14:56:56 +0100 Subject: [PATCH 07/15] Linting --- docs/source/programming/index.md | 2 +- docs/source/programming/port-fowarding.md | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/source/programming/index.md b/docs/source/programming/index.md index c943af9..c022ac7 100644 --- a/docs/source/programming/index.md +++ b/docs/source/programming/index.md @@ -14,6 +14,6 @@ vscode-with-slurm-job Mount-ceph-ubuntu Mount-ceph-ubuntu-temp Cookiecutter-cruft -Troubleshooting port-fowarding +Troubleshooting ``` diff --git a/docs/source/programming/port-fowarding.md b/docs/source/programming/port-fowarding.md index 5288b75..b4ace28 100644 --- a/docs/source/programming/port-fowarding.md +++ b/docs/source/programming/port-fowarding.md @@ -155,4 +155,3 @@ if __name__ == "__main__": ```bash streamlit run app.py --server.port 8501 --server.address 0.0.0.0 ``` - From 7fb8c191cc947982d0023c89bd77315325ea865b Mon Sep 17 00:00:00 2001 From: Laura Porta Date: Fri, 4 Jul 2025 11:22:19 +0100 Subject: [PATCH 08/15] Update docs/source/programming/port-fowarding.md Co-authored-by: Igor Tatarnikov <61896994+IgorTatarnikov@users.noreply.github.com> --- docs/source/programming/port-fowarding.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/programming/port-fowarding.md b/docs/source/programming/port-fowarding.md index b4ace28..9acd3bc 100644 --- a/docs/source/programming/port-fowarding.md +++ b/docs/source/programming/port-fowarding.md @@ -53,7 +53,7 @@ Jupyter will start and display a link with a token. On **your local machine**, open a separate terminal and run: ```bash -ssh -N @ -J @ssh.swc.ucl.ac.uk,@ -L 8082:localhost:8082 +ssh -N @ -J @ssh.swc.ucl.ac.uk,@hpc-gw2 -L 8082:localhost:8082 ``` Replace `` with the actual name of the compute node assigned to you (e.g., `gpu-sr670-20`). This command establishes a secure tunnel between your laptop and the node. From 68ee87be5f4ff55dad3a8817101cc8143279cf1f Mon Sep 17 00:00:00 2001 From: Laura Porta Date: Fri, 4 Jul 2025 11:22:42 +0100 Subject: [PATCH 09/15] Update docs/source/programming/port-fowarding.md Co-authored-by: Igor Tatarnikov <61896994+IgorTatarnikov@users.noreply.github.com> --- docs/source/programming/port-fowarding.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/source/programming/port-fowarding.md b/docs/source/programming/port-fowarding.md index 9acd3bc..6a9ebc8 100644 --- a/docs/source/programming/port-fowarding.md +++ b/docs/source/programming/port-fowarding.md @@ -146,9 +146,6 @@ import streamlit as st st.title("My Streamlit App") st.write("This is a simple Streamlit app.") - -if __name__ == "__main__": - st.run() ``` **On the compute node**, launch Streamlit with a specific port: From 42a8691c5a0bcd1473b7a6c00b62d6a965abe877 Mon Sep 17 00:00:00 2001 From: Laura Porta Date: Fri, 4 Jul 2025 11:23:04 +0100 Subject: [PATCH 10/15] Update docs/source/programming/port-fowarding.md Co-authored-by: Igor Tatarnikov <61896994+IgorTatarnikov@users.noreply.github.com> --- docs/source/programming/port-fowarding.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/programming/port-fowarding.md b/docs/source/programming/port-fowarding.md index 6a9ebc8..fe2e5cb 100644 --- a/docs/source/programming/port-fowarding.md +++ b/docs/source/programming/port-fowarding.md @@ -133,7 +133,7 @@ app.layout = html.Div([ ]) if __name__ == '__main__': - app.run_server(debug=False, host='0.0.0.0', port=8050) + app.run(debug=False, host='0.0.0.0', port=8050) ``` From d51d9c0ddf4fe0cae7cc9259ba2438bdaaa1da39 Mon Sep 17 00:00:00 2001 From: Laura Porta Date: Fri, 4 Jul 2025 11:23:20 +0100 Subject: [PATCH 11/15] Update docs/source/programming/port-fowarding.md Co-authored-by: Igor Tatarnikov <61896994+IgorTatarnikov@users.noreply.github.com> --- docs/source/programming/port-fowarding.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/programming/port-fowarding.md b/docs/source/programming/port-fowarding.md index fe2e5cb..c337da0 100644 --- a/docs/source/programming/port-fowarding.md +++ b/docs/source/programming/port-fowarding.md @@ -1,4 +1,4 @@ -# Port Forwarding for Jupyter and HPC Jobs +# Accessing HTTP servers running on the HPC with port forwarding This guide explains how to securely and effectively forward ports from a compute node on the SWC HPC cluster to your local machine, enabling access to services like Jupyter Lab. This is particularly useful when `code tunnel` is unreliable or you prefer using a terminal-based workflow. From 9035d37b95bd5e6d4c5ad51132b691330b95b21f Mon Sep 17 00:00:00 2001 From: lauraporta <29216006+lauraporta@users.noreply.github.com> Date: Mon, 21 Jul 2025 18:15:38 +0100 Subject: [PATCH 12/15] Apply Igor's suggestions --- docs/source/programming/port-fowarding.md | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/docs/source/programming/port-fowarding.md b/docs/source/programming/port-fowarding.md index c337da0..b32f9f7 100644 --- a/docs/source/programming/port-fowarding.md +++ b/docs/source/programming/port-fowarding.md @@ -58,13 +58,7 @@ ssh -N @ -J @ssh.swc.ucl.ac.uk,` with the actual name of the compute node assigned to you (e.g., `gpu-sr670-20`). This command establishes a secure tunnel between your laptop and the node. -Then, **in your browser**, go to: - -``` -http://localhost:8082 -``` - -Paste in the token provided by the `jupyter lab` output. +Then, **in your browser**, copy the complete URL from the Jupyter Lab output (change `127.0.0.1` to `localhost`) or go to `http://localhost:8082` and paste the token. --- @@ -113,13 +107,7 @@ If you prefer a fully integrated development environment and are okay with occas For Dash applications, you can follow the same port forwarding approach: -**On the compute node**, launch your Dash app with a specific port: - -```bash -python app.py -``` - -Where your `app.py` contains: +Create your `app.py`: ```python from dash import Dash, html, dcc @@ -136,6 +124,12 @@ if __name__ == '__main__': app.run(debug=False, host='0.0.0.0', port=8050) ``` +**On the compute node**, launch your Dash app: + +```bash +python app.py +``` + ### Streamlit Applications From 4461e481deb3543bc992484a5ddba5bf7d9c0be3 Mon Sep 17 00:00:00 2001 From: lauraporta <29216006+lauraporta@users.noreply.github.com> Date: Mon, 21 Jul 2025 18:26:53 +0100 Subject: [PATCH 13/15] Suggest conda instead --- docs/source/programming/port-fowarding.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/programming/port-fowarding.md b/docs/source/programming/port-fowarding.md index b32f9f7..7c678e5 100644 --- a/docs/source/programming/port-fowarding.md +++ b/docs/source/programming/port-fowarding.md @@ -34,7 +34,7 @@ This will assign you a compute node using one GPU and give you an interactive sh On the assigned node, activate your environment and navigate to your project folder: ```bash -pyenv activate my_venv_3115 +conda activate my_env cd /path/to/your/project ``` From dc285b3f59e7f2ff1b94df137abe4f09e9915cb0 Mon Sep 17 00:00:00 2001 From: lauraporta <29216006+lauraporta@users.noreply.github.com> Date: Mon, 21 Jul 2025 18:28:25 +0100 Subject: [PATCH 14/15] Remove unnecessary discussion --- docs/source/programming/port-fowarding.md | 32 +++-------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/docs/source/programming/port-fowarding.md b/docs/source/programming/port-fowarding.md index 7c678e5..5cba1d5 100644 --- a/docs/source/programming/port-fowarding.md +++ b/docs/source/programming/port-fowarding.md @@ -61,41 +61,17 @@ Replace `` with the actual name of the compute node assigned to you ( Then, **in your browser**, copy the complete URL from the Jupyter Lab output (change `127.0.0.1` to `localhost`) or go to `http://localhost:8082` and paste the token. --- - -### 4. Notes on usage and cluster rules - -This method **respects cluster usage policies** because: - -- You are only SSHing into a node **you were explicitly allocated by SLURM**. -- The port forwarding (`ssh -L`) only gives you access to services running **on the localhost of that node**, not to shared resources. - -:::note -Using `ssh -L` on an allocated node is generally considered safe, as long as you're not trying to bypass SLURM's resource management or share your access with others. -::: - ---- - -## When to use this method - -You may prefer this method when: - -- `code tunnel` times out frequently or becomes unreliable. -- You don't need a full GUI like VSCode but still want access to Jupyter or HTTP apps. -- You're comfortable with the command line and prefer manual control over your environment. - ---- - ## Troubleshooting -- **Jupyter not accessible at `localhost:8082`?** Make sure the ports match exactly in both commands. -- **Timeouts or connection drops?** Ensure you're using the assigned node and haven't closed the original SLURM session. -- **Port already in use?** Try another port like `8888`, `8090`, etc., just remember to update both commands. +- **Port mismatch?** Ensure both commands use the same port number. +- **Connection drops?** Keep your SLURM session active on the assigned node. +- **Port in use?** Try a different port (e.g., `8888`, `8090`) in both commands. --- ## Complementary tools -If you prefer a fully integrated development environment and are okay with occasional tunnel issues, see our guide on: +If you prefer a fully integrated development environment see our guide on: [Using VSCode with Interactive SLURM Jobs →](./vscode-with-slurm-job.md) From ff2a5152c44727ee75a6e522dad2fe4c109fe52d Mon Sep 17 00:00:00 2001 From: lauraporta <29216006+lauraporta@users.noreply.github.com> Date: Mon, 21 Jul 2025 18:43:14 +0100 Subject: [PATCH 15/15] Be a bit more explicit n how to find the link with the token --- docs/source/programming/port-fowarding.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/source/programming/port-fowarding.md b/docs/source/programming/port-fowarding.md index 5cba1d5..492b667 100644 --- a/docs/source/programming/port-fowarding.md +++ b/docs/source/programming/port-fowarding.md @@ -44,7 +44,19 @@ Then launch Jupyter Lab, specifying a port (e.g., 8082) and disabling the browse jupyter lab --no-browser --port=8082 ``` -Jupyter will start and display a link with a token. +Jupyter will start and display output similar to this: + +``` +[I 2024-01-01 12:00:00.000 ServerApp] Jupyter Server 2.14.2 is running at: +[I 2024-01-01 12:00:00.000 ServerApp] http://localhost:8082/lab?token=abc123def456... +[I 2024-01-01 12:00:00.000 ServerApp] http://127.0.0.1:8082/lab?token=abc123def456... +... + Or copy and paste one of these URLs: + http://localhost:8082/lab?token=abc123def456... + http://127.0.0.1:8082/lab?token=abc123def456... +``` + +**Look for the lines that say "Or copy and paste one of these URLs:"** - these contain the complete URLs with the authentication token that you'll need to access Jupyter Lab from your browser. --- @@ -58,7 +70,13 @@ ssh -N @ -J @ssh.swc.ucl.ac.uk,` with the actual name of the compute node assigned to you (e.g., `gpu-sr670-20`). This command establishes a secure tunnel between your laptop and the node. -Then, **in your browser**, copy the complete URL from the Jupyter Lab output (change `127.0.0.1` to `localhost`) or go to `http://localhost:8082` and paste the token. +Then, **in your browser**, copy one of the complete URLs from the Jupyter Lab output. For example, from the output above, you would copy: + +``` +http://localhost:8082/lab?token=abc123def456... +``` + +**Note:** Either URL works, but you can change `127.0.0.1` to `localhost` if needed. The important part is to **copy the entire URL including the `?token=` portion** - this token is what authenticates you to the Jupyter server. --- ## Troubleshooting