Skip to content

Option for VS Code debugging within a job #598

Description

@mnblonsky

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions