Skip to content
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

[python] Link lifetimes of SOMAArray and ManagedQuery #3516

Merged

Conversation

nguyenv
Copy link
Member

@nguyenv nguyenv commented Jan 6, 2025

Issue and/or context:

[sc-61128]

Changes:

  • Introduce a high-level ManagedQuery class, analogous to the other SOMAObject classes, serving as a thin wrapper around the clib.ManagedQuery pybind11 object. This class links together the lifetime of clib.ManagedQuery to the high-level SOMAArray object (not clib.SOMAArray)
  • Clean up the array setters in _util.py to use the _array stored in ManagedQuery, eliminating the need to pass the array in as a separate argument
  • Add a test to confirm the resolution of the previously reported bug and to ensure separate SOMArray instances at the same URI iterate using distinct ManagedQuery instances

Notes for Reviewer:

Another solution for the reported bug is to pass a shared_ptr<SOMAArray> instead of unique_ptr into the clib.ManagedQuery constructor. This is similar to what we already do for clib.SOMAContext. We attempted this solution, but it was unfeasible to a bug in the Pybind11 library. A pull request addressing this issue is currently under review: pybind/pybind11#2839. Given the current circumstances, the most effective solution is to implement this high-level thin wrapper class.

@nguyenv nguyenv marked this pull request as ready for review January 6, 2025 19:58
@nguyenv nguyenv changed the title [python] Link lifetime of SOMAArray to ManagedQuery [python] Link lifetimes of SOMAArray and ManagedQuery Jan 6, 2025
@nguyenv nguyenv requested a review from bkmartinjr January 6, 2025 20:20
Copy link

codecov bot commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 97.91667% with 1 line in your changes missing coverage. Please review.

Project coverage is 86.31%. Comparing base (7addb3e) to head (36adfcd).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3516      +/-   ##
==========================================
+ Coverage   86.22%   86.31%   +0.08%     
==========================================
  Files          55       55              
  Lines        6344     6349       +5     
==========================================
+ Hits         5470     5480      +10     
+ Misses        874      869       -5     
Flag Coverage Δ
python 86.31% <97.91%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
python_api 86.31% <97.91%> (+0.08%) ⬆️
libtiledbsoma ∅ <ø> (∅)

Copy link
Member

@bkmartinjr bkmartinjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did a visual code review only - it looks great.

@nguyenv nguyenv merged commit b3f9df0 into main Jan 6, 2025
11 checks passed
@nguyenv nguyenv deleted the viviannguyen/sc-61128/python-1-15-regression-on-table-iterator branch January 6, 2025 23:27
johnkerl pushed a commit that referenced this pull request Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants