-
Notifications
You must be signed in to change notification settings - Fork 84
docs: debugging instructions for docker #114
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
Merged
jandom
merged 2 commits into
main
from
jandom/2026-02/docs/debugging-instructions-for-docker
Feb 5, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,4 +13,5 @@ | |
| !environments/** | ||
| !examples/** | ||
| !openfold3/** | ||
| !scripts/** | ||
| !scripts/** | ||
| !examples/** | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # Debugging OpenFold | ||
|
|
||
| ## Docker | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - VS Code with the debugpy extension | ||
| - OpenFold docker image with `debugpy` installed | ||
|
|
||
|
|
||
| ```bash | ||
| docker run --rm \ | ||
| --ipc=host \ | ||
| -it openfold-docker:devel \ | ||
| python -c "import debugpy; print(debugpy)" | ||
| ... | ||
| <module 'debugpy' from '/opt/conda/envs/openfold3/lib/python3.12/site-packages/debugpy/__init__.py'> | ||
| ``` | ||
|
|
||
| ### Step 1: Instrument your code | ||
|
|
||
| Put this snippet at the very top of your launch script | ||
|
|
||
| ```python | ||
| import debugpy | ||
| debugpy.listen(("0.0.0.0", 5678)) | ||
| print("Waiting for debugger to attach...") | ||
| debugpy.wait_for_client() | ||
| ``` | ||
|
|
||
| For example, put this at the very top of `openfold3/run_openfold.py` | ||
|
|
||
|
|
||
| ### Step 2: Create a launch configuration | ||
|
|
||
| Create `.vscode/launch.json` to tell VS Code to connect to `localhost:5678` on the docker container. | ||
|
|
||
| ```json | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "name": "Python: Remote Attach", | ||
| "type": "debugpy", | ||
| "request": "attach", | ||
| "connect": { | ||
| "host": "localhost", | ||
| "port": 5678 | ||
| }, | ||
| "pathMappings": [ | ||
| { | ||
| "localRoot": "${workspaceFolder:openfold-3}", | ||
| "remoteRoot": "/opt/openfold3" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| > **Note**: Use `${workspaceFolder}` instead if openfold-3 is your only workspace folder. | ||
|
|
||
| ### Step 3: Launch your container | ||
|
|
||
| Launch the docker container with the debugger port exposed: | ||
|
|
||
| ```bash | ||
| docker run --rm \ | ||
| --gpus all \ | ||
| --ipc=host \ | ||
| -p 5678:5678 \ | ||
| -it openfold-docker:devel \ | ||
| run_openfold predict \ | ||
| --query_json /data/query.json \ | ||
| --runner_yaml ./examples/example_runner_yamls/low_mem.yml \ | ||
| --output_dir /tmp/output | ||
| ``` | ||
|
|
||
| > **Important**: The `-p 5678:5678` flag is required to expose the debugger port. | ||
|
|
||
| The script will print "Waiting for debugger to attach..." and pause until you connect. | ||
|
|
||
| ### Step 4: Attach the debugger | ||
|
|
||
| In VS Code, open the Run and Debug panel (`Ctrl+Shift+D`) and click the green play button to attach. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,6 +70,7 @@ test = [ | |
| "pytest-xdist", | ||
| "pytest-cov", | ||
| "pytest-benchmark", | ||
| "debugpy", | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This allows for the interactive debugger, added as a test dep |
||
| ] | ||
|
|
||
| [project.optional-dependencies] | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated but helpful: we previously were excluding the JSON examples from the docker image, they're actually quite nice to have baked in