-
-
Notifications
You must be signed in to change notification settings - Fork 323
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
N5FSStore #793
N5FSStore #793
Conversation
Previous tests (now commented out) used logic in the store classes to convert "0/0" keys into "0.0" keys, forcing the store to be aware of array details. This tries to swap the logic so that stores are responsible for passing dimension separator values down to the arrays only. Since arrays can also get the dimension_separator value from a .zarray file they are now in charge.
Codecov Report
@@ Coverage Diff @@
## master #793 +/- ##
========================================
Coverage 99.94% 99.94%
========================================
Files 31 31
Lines 10681 10936 +255
========================================
+ Hits 10675 10930 +255
Misses 6 6
|
Note that #773 is still passing against this branch. Any thoughts on moving forward here, @d-v-b, re: #769 (comment)? (Personally, I'd be in favor of prioritizing a fix for the state of dimension_separator over code coverage if need be) |
@joshmoore please try again, I discovered that this branch was missing N5FSStore tests in |
…into n5fsstore
zarr/tests/test_storage.py
Outdated
@@ -1207,7 +1207,7 @@ def test_chunk_nesting(self): | |||
assert 'foo/10.20.30' in store | |||
assert b'yyy' == store['foo/10.20.30'] | |||
# N5 reverses axis order | |||
# assert b'yyy' == store['foo/30/20/10'] | |||
assert b'yyy' == store['foo/30/20/10'] |
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.
Per #773 (review), I have a heard time understanding how it's possible to support the requirement that multiple keys be supported for the same item.
This may be part and parcel of the conversation we're having in gitter: https://gitter.im/zarr-developers/community?at=611d562e933ee46b7564044c
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.
Update: ah, now I see that they are re-ordered not just .
//
swapped, but I think my same concern holds.
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 agree with the concern -- it looks like this behavior is expected from the NestedDirectoryStore: https://github.com/zarr-developers/zarr-python/blob/master/zarr/tests/test_storage.py#L1148
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 my PR I resurrected this. I at least understand know why it's supported, though I think it's a hackdoor of sorts.
Sounds good. If you want to test a reversion of the hexdigests, you can pin numcodecs to |
…stdir, and add crucial lstrip
…e dimension_separator keyword now present in metadata
b8f12a8
to
5fcf68d
Compare
* Adds a test for the dimension_separator warning * uses the parent test_complex for listdir * "nocover" the import error since fsspec is ever present
5fcf68d
to
3b56155
Compare
@d-v-b: I pushed a commit trying to get codecov to 100%. I'm still having difficulty getting the likes of:
|
@joshmoore I copied a |
Sounds good. Three Friday evening points:
|
By "two versions" do you mean the N5Store and N5FSStore? Given that a) n5 is relatively niche, and this was flagged as experimental, and b) fsspec isn't a super heavy dependency, I agree that a quick deprecation path looks nice. Version-wise I could think this is minor? since we are adding to the public API. |
zarr/storage.py
Outdated
@@ -1065,22 +1065,28 @@ class FSStore(MutableMapping): | |||
Separator placed between the dimensions of a chunk. | |||
storage_options : passed to the fsspec implementation | |||
""" | |||
array_meta_key = array_meta_key |
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, I missed these. Would it make sense to have these prefixed with _
. Do you really mean these to be public API?
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.
good question! I'm fine with making these private.
FSStore only throws ModuleNotFoundError on initialization rather than on import. Therefore N5FSStore does the same. If this *weren't* the case, then the import in zarr/init would need to test the import as well, which isn't the case.
@@ -9,7 +9,7 @@ | |||
zeros_like) | |||
from zarr.errors import CopyError, MetadataError | |||
from zarr.hierarchy import Group, group, open_group | |||
from zarr.n5 import N5Store | |||
from zarr.n5 import N5Store, N5FSStore |
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.
This concerned me that it would need protecting by try/except block. In testing it, I realized FSStore only throws on __init__
and therefore N5FSStore could be less conservative. I've pushed:
protocol, _ = fsspec.core.split_protocol(url) | ||
# set auto_mkdir to True for local file system | ||
if protocol in (None, "file") and not storage_options.get("auto_mkdir"): | ||
storage_options["auto_mkdir"] = True |
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.
❤️
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.
Thanks for this, @d-v-b! Pushing forward with a minor release.
Thanks for your help @joshmoore! |
An fsstore-backed implementation of n5
There's a lot of ugly duplicated logic in
n5.py
. It might be worth some time cleaning that up.cc @joshmoore, in case you want to test dimension_separator stuff against this branch
TODO: