Repository navigation
[DOC] pyOpenMS: document thread-safety / GIL-release contract (#9792 R-9.5) - #9857
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR adds pyOpenMS development links and a thread-safety contract. The contract covers concurrent access, shared storage, worker isolation, callbacks, GIL-release sites, filtering parallelism, OpenMP usage, and maintenance requirements. ChangespyOpenMS Documentation
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/pyOpenMS/THREAD_SAFETY.md`:
- Line 31: Update the concurrency note for TransitionListEvidenceFilter.filter
to state that worker threads concurrently read the active SWATH maps and derived
candidates/index data, while transition_exp is only read during candidate
construction before the threaded scan. Do not describe transition_exp as being
accessed by worker threads.
- Line 16: Update the streaming-reader callback statement in THREAD_SAFETY.md to
remove the universal GIL reacquisition guarantee, or scope it only to
streaming-reader APIs that explicitly invoke the gil_scoped_acquire path; retain
the guidance about synchronizing access to reader input/output objects.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0a1d956c-0961-4e83-ad73-6885f91540b5
📒 Files selected for processing (2)
src/pyOpenMS/README.mdsrc/pyOpenMS/THREAD_SAFETY.md
|
@jpfeuffer Please review this PR when you have time. Thanks ! |
|
I guess it's fine. It's quite defensive. I think there are many read-only or partitioning style applications where it is safe to access a static MSExperiment (for example) via multiple threads. One problem that is not really explained by your docs is the potential oversubscription of threads when calling OpenMS function that are internally parallelized by OpenMP. One should explain how to set the parallelism level of OpenMS to avoid that. |
|
@jpfeuffer Pushed another commit, solving the concerns you raised. Please review that. Thanks ! |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/pyOpenMS/THREAD_SAFETY.md`:
- Around line 13-14: Update the thread-safety guidance around the two bullets so
the read-only concurrency exception applies only to fully initialized types or
APIs that explicitly document concurrent read access, while retaining the
prohibition when any thread writes. Qualify the GIL-releasing-call rule to
prohibit concurrent access when the call may mutate the object or expose
writable aliased storage, and remove the broader implication of a general OpenMS
core thread-safety guarantee.
- Around line 35-40: Update the “Avoiding OpenMP oversubscription” guidance
around OpenMSBuildInfo.setOpenMPNumThreads so it describes the cap as
task-scoped rather than a single worker-global setting. State that, after
OMP_NUM_THREADS is unset, each Python worker should call setOpenMPNumThreads
before entering OpenMS-parallel work, and clarify that setting it only in the
parent process does not propagate independently to workers.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2c0e5ccd-5874-4172-b904-07abaf1fef96
📒 Files selected for processing (1)
src/pyOpenMS/THREAD_SAFETY.md
1309ce3 to
4cf0277
Compare
|
yes better, thank you |
|
@timosachsenberg This PR has been approved. You may merge it now. |
Routine changelog audit of PRs merged since the last CHANGELOG update (#9902, merged 2026-08-11 06:20 UTC). Two PRs merged in that window: #9857 and #9887. - #9887 (ccache strategy/statistics in CI) is workflow-only with no code changes; its own description notes no CHANGELOG entry applies. - #9857 added src/pyOpenMS/THREAD_SAFETY.md, a new pyOpenMS thread-safety/GIL-release contract document (part of #9792). Added a bullet under PyOpenMS: documenting it, consistent with the other #9792-related entries already in that section. Co-authored-by: Claude <[email protected]>
@timosachsenberg
Description
Added THREAD_SAFETY.md covering what the pyOpenMS binding layer actually guarantees around concurrency, since GIL release is often mistaken for thread safety.
Covers:
No behavior change, docs only. Linked from README.md so it's discoverable outside this PR.
Part of #9792 (R-9.5).
Checklist
Please review this PR, and merge if it's suitable. Thanks !
Summary by CodeRabbit