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

allow control of memmapping for asdf files #232

Merged
merged 2 commits into from
Dec 7, 2023

Conversation

braingram
Copy link
Collaborator

@braingram braingram commented Oct 30, 2023

This PR allows control of memory mapping when opening an asdf file using DataModel(asdf_filename). Control of memory mapping already exists for FITS files (through the memmap argument which is reused here).

asdf is making a few changes to memory mapping. This PR will help to prepare stdatamodels for those changes. Specifically, asdf will no longer force closure of memory mapped view of arrays (which can and often results in a segfault when an array access fails during an attempt to access the closed file). Instead, asdf will release all references to the opened memory map and rely on the garbage collector to close the file (see this asdf PR for more details: asdf-format/asdf#1668). This works in most situations but is complicated in a few stdatamodels tests which test for the number of open files without first destroying the model. This PR (by using the default memmap=False) allows the effected tests to pass as they no longer use memory mapping.

Regression tests: https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1025/
show only existing 8 unrelated failures (due to niriss crds file updates).

Checklist

  • added entry in CHANGES.rst (either in Bug Fixes or Changes to API)
  • updated relevant tests
  • updated relevant documentation
  • updated relevant milestone(s)
  • added relevant label(s)

Copy link

codecov bot commented Nov 16, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1180473) 64.77% compared to head (8515e2b) 64.78%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #232   +/-   ##
=======================================
  Coverage   64.77%   64.78%           
=======================================
  Files         103      103           
  Lines        5687     5688    +1     
=======================================
+ Hits         3684     3685    +1     
  Misses       2003     2003           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@braingram braingram force-pushed the asdf_memmap branch 3 times, most recently from 87b0c93 to cd153b2 Compare December 6, 2023 16:10
Copy link
Collaborator

@hbushouse hbushouse left a comment

Choose a reason for hiding this comment

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

LGTM

@braingram braingram merged commit bbc9016 into spacetelescope:master Dec 7, 2023
21 of 22 checks passed
@braingram braingram deleted the asdf_memmap branch December 7, 2023 13:37
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.

2 participants