Repository navigation
[pyOpenMS][TEST] Prove Arrow zero-copy exports survive owner GC (#9460) - #9543
Conversation
…MS#9460) pyopenms._arrow_zerocopy.spectra_to_arrow()/chromatograms_to_arrow() hand peak buffers to PyArrow over the C Data Interface; their lifetime rides on Arrow's release callback, not the source MSExperiment. The existing test_arrow_zerocopy.py only checks shapes/columns -- never that the data survives the source being freed. Adds lifetime tests (numpy/pyarrow importorskip): snapshot every column WHILE the source experiment is alive, then `del` it + gc.collect(), then re-read and assert byte-equality (and that the owner-less buffers still rebuild into a fresh table). The snapshot is taken before deletion so the comparison cannot pass vacuously. Closes the zero-copy-lifetime part of issue OpenMS#9460 Section 2. Verified against the built nanobind bindings (2 passed). Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Warning Review limit reached
More reviews will be available in 5 minutes and 34 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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 |
|
@timosachsenberg The following names might be missing from the
Please consider applying the following patch: --- AUTHORS 2026-06-15 17:57:22.562596841 +0000
+++ AUTHORS.new 2026-06-15 17:57:27.787211968 +0000
@@ -23,8 +23,8 @@
- Chirag Dave
- Chris Bauer
- Chris Bielow
- - Christie Mathews
- Christian Ehrlich
+ - Christie Mathews
- Clemens Groepl
- Cornelia Friedle
- Daniel Jameson |
What
Adds lifetime tests (numpy/pyarrow
importorskip) for the Arrow zero-copy exportersspectra_to_arrow()/chromatograms_to_arrow():MSExperimentis still alive,delthe experiment +gc.collect(),The snapshot is taken before deletion, so the comparison cannot pass vacuously (comparing corrupted data against itself).
Why
Closes the zero-copy-lifetime part of the §2 (pyOpenMS nanobind rewrite)
[AUTO]task in the OpenMS 3.6.0 pre-release testing plan (#9460):This is the riskiest of the zero-copy paths: unlike the numpy getters (which own their buffer via an
nb::capsule+delete[], already covered bytest_spectrum_zerocopy.py), the Arrow exports' buffer lifetime is detached from the source experiment.test_arrow_zerocopy.pyexercised only shapes/columns/formats — never source-GC survival.Test plan
Tests only — no production code changed. Verified against the built nanobind bindings two ways: direct script (
All arrow zero-copy lifetime tests passed!) andpytest(2 passed).numpy/pyarrowimportorskipkeep it optional; the modules used (experiment/spectrum/kernel+_arrow_zerocopy) are unaffected by the unrelated stale-build_pyopenms_analysiswarning.Part of #9460. Follows #9524 … #9542.
🤖 Generated with Claude Code