Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option for VS Code debugging within a job #598

Open
mnblonsky opened this issue Mar 20, 2024 · 0 comments
Open

Option for VS Code debugging within a job #598

mnblonsky opened this issue Mar 20, 2024 · 0 comments
Assignees

Comments

@mnblonsky
Copy link

Thanks for including documentation on using VS Code on HPC. I have a method for attaching a python debug process that others may find useful. Feel free to add this to the VS Code docs page if you're interested.

Tips for debugging on HPC

  1. Create a "Python: Remote Attach" configuration in VS Code
  • use localhost and port 5678
  • no adjustments to defaults needed
  1. Start an interactive job
salloc --partition=debug --qos=high --time=10 --account=<account>

record the <user@hostname> for that job (e.g. mblonsky@x1008c0s0b0n1)

  1. Open a new terminal and create an ssh tunnel from a login node to the interactive job node
ssh -2 -L 5678:localhost:5678 <user@hostname>
  1. In the interactive job terminal run your code using the debugpy module (you may need to update your environment or install the debugpy package):
python -m debugpy --wait-for-client --listen 5678 <my_script.py> <my_args>
  1. Run the "Python: Remote Attach" debug configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants