A helper tool for remote debugging on HPC clusters.
Project description
🚀 remote-debug
A CLI tool to simplify visual debugging of Python scripts on remote HPC clusters directly from your local VS Code instance.
remote-debug helps you bridge the gap between your local editor and a script running on a remote compute node, making it easy to debug GPU-specific issues or complex cluster jobs with a full-featured debugger.
Table of Contents
Installation
Install from PyPI:
pip install remote-debug
Or, build from source using Pixi:
# Install pixi with: curl -fsSL https://pixi.sh/install.sh | sh
pixi install
Quick Start
-
Initialize your project This command creates the necessary VS Code launch configurations in
.vscode/launch.json.remote-debug init[!WARNING] If
launch.jsonexists but is malformed, it will be backed up tolaunch.json.bakand a new file will be created. -
Run your script on the cluster Prefix your usual Python command with
remote-debug debug. This will start a debug server and wait for you to connect.# Instead of: python my_script.py --arg value # Run this: remote-debug debug my_script.py --arg value
-
Check your job's output The job output will contain the connection details needed to attach the debugger.
--- Python Debugger Info --- Node: uc2n805.localdomain Port: 51041 Remote Path: /path/to/your/project -------------------------- Script is paused, waiting for debugger to attach..
-
Connect VS Code Follow one of the two methods below depending on your setup. Once attached, you can set breakpoints and debug as if you were running the code locally.
Debugging Workflow
Method A: Connecting from your Local Machine
Use this method if you are running VS Code locally and want to connect to the remote cluster.
-
Create an SSH Tunnel On your local machine, run the
tunnelcommand using theNodeandPortfrom the job output, along with your cluster's SSH login details.# remote-debug tunnel <NODE> <REMOTE_PORT> <SSH_LOGIN> remote-debug tunnel uc2n805.localdomain 51041 username@cluster.hostname.com
This will generate an
sshcommand. Copy, paste, and run it in a new terminal to establish the tunnel. Keep this terminal open. -
Attach VS Code
- Open the "Run and Debug" panel in VS Code (Ctrl+Shift+D).
- Select "Python Debugger: Remote Attach (via SSH Tunnel)" from the dropdown and click the play button.
- You will be prompted for:
localTunnelPort: The local port for the tunnel (default is5678).remoteWorkspaceFolder: TheRemote Pathfrom the job output.
Method B: Connecting via VS Code Remote-SSH
Use this method if you are already connected to a remote machine (like a login node) using the VS Code Remote - SSH extension.
- Attach VS Code
- Open the "Run and Debug" panel in VS Code (Ctrl+Shift+D).
- Select "Python Debugger: Attach to Compute Node" from the dropdown and click the play button.
- You will be prompted for:
computeNodeHost: TheNodefrom the job output.computeNodePort: ThePortfrom the job output.
Command Reference
| Command | Description |
|---|---|
remote-debug <script> [args...] |
Wraps a Python script to start a debugpy listener and waits for a client to attach. |
remote-debug init |
Creates or updates .vscode/launch.json with the required debugger configurations. |
remote-debug tunnel <node> <port> <login> |
Constructs the SSH command to establish a tunnel to the compute node. |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file remote_debug-0.2.2.tar.gz.
File metadata
- Download URL: remote_debug-0.2.2.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17dfcc54dd7c8d36ac306c3766c3bfce250be0a0f3e8f9d884aeefac614eb9af
|
|
| MD5 |
31552c4a7903f3998416f8181731ead7
|
|
| BLAKE2b-256 |
302c1522ed594ccc7e7499f3abd5a8fc2f81830014017c5e2da05ad5fb69ff0f
|
File details
Details for the file remote_debug-0.2.2-py3-none-any.whl.
File metadata
- Download URL: remote_debug-0.2.2-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
febc4a7177056fc31aeca67b21da832a19f37935eb65e1390aa3484e838e17e1
|
|
| MD5 |
3ec54701176a94449b1745900f5153ce
|
|
| BLAKE2b-256 |
4908e0bc160f2fb8c972682853aef4c6714181553a27805b7b1ccbccbd909754
|