- Adding print statements to local code or the remote code directly can be rough.
- Take advantage of Python’s support for remote application debugging.
Guide
- Install debugpy on the remote container. This can be used directly on the command-line. It’s especially helpful when running a test script.
- Create a
launch.json
file in a.vscode
folder in your workspace
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Remote Attach",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
"justMyCode": false,
"pathMappings": [
{
"localRoot": "${workspaceFolder}/vllm",
"remoteRoot": "${workspace/path}/vllm"
}
]
}
]
}
- Port-forward your container
- Run your script using
debugpy
python3 -m debugpy --listen localhost:5678 --wait-for-client -m vllm.entrypoints.openai.api_server {args}
Resources:
VS Code Python Debugger Extension
DebugPy