-
Notifications
You must be signed in to change notification settings - Fork 58
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
add memmap
option to asdf.open
#1667
Conversation
405cf1c
to
2e09f0f
Compare
9a8346e
to
28c99c4
Compare
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.
sorry to take so long to review this!
asdf/asdf.py
Outdated
@@ -116,6 +117,14 @@ def __init__( | |||
When `False`, when reading files, attempt to memmap underlying data | |||
arrays when possible. | |||
|
|||
memmap_arrays : bool, optional |
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.
Is it more accurate to call this memmap_blocks
? Or is it truly only arrays that are memory-mapped?
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.
Hmmm. I think blocks is a better match as arrays can be inline (and not memapped). Thanks! I'll update this PR.
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.
On second thought, should we just make this memmap
?
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.
I updated this PR to use memmap
. I'm happy to discuss alternatives (like memmap_blocks
) and don't feel strongly about the naming of this argument. I went with memmap
for a few reasons:
- it's shorter to type than
memmap_blocks
which still describing the basic option (memory mapping) - in case we come up with some new crazy way to memory map things (like the tree) the option should be forward compatible
- although not a general goal of asdf, it does more closely match the astropy API for fits files
28c99c4
to
451a7a5
Compare
asdf.open
memmap
option to asdf.open
451a7a5
to
1ee4b99
Compare
This is the first in a sequence of changes to switch
copy_arrays
tomemmap
and to change the default to not memmap. I'm proposing that we do the following:memmap
as a new argument toasdf.open
(this PR) which when set, overridescopy_arrays
. Introducing this first will allow libraries that usecopy_arrays
to switch tomemmap
. The documentation formemmap
includes a warning that the default for this option will change in an upcoming version of asdf.copy_arrays
with a warning that describing usingmemmap
and that the default will change.copy_arrays
and switchmemmap
to default toFalse
If the above plan is agreeable I will open issues to track the second and third changes and milestone them for 3.2 and 4.0 respectively.
devdeps failures are unrelated and addressed in: #1665