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

Update Array to respect FSStore's key_separator #718

Merged
merged 5 commits into from
Apr 16, 2021

Conversation

grlee77
Copy link
Contributor

@grlee77 grlee77 commented Apr 15, 2021

[Description of PR]

closes #717

I added a couple of FSStore test classes to test_hierarchy.py. The "NestedFSStore" class tests the fix on the specific case raised in #717.

TODO:

  • Add unit tests and/or doctests in docstrings
    * [ ] Add docstrings and API docs for any new/modified user-facing classes and functions
    * [ ] New/modified features documented in docs/tutorial.rst
  • Changes documented in docs/release.rst
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@codecov
Copy link

codecov bot commented Apr 15, 2021

Codecov Report

Merging #718 (14db70e) into master (17728e8) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           master     #718    +/-   ##
========================================
  Coverage   99.93%   99.94%            
========================================
  Files          26       28     +2     
  Lines        9945    10328   +383     
========================================
+ Hits         9939    10322   +383     
  Misses          6        6            
Impacted Files Coverage Δ
zarr/core.py 100.00% <100.00%> (ø)
zarr/tests/test_hierarchy.py 100.00% <100.00%> (ø)
zarr/util.py 100.00% <0.00%> (ø)
zarr/__init__.py 100.00% <0.00%> (ø)

@@ -1950,7 +1950,11 @@ def _process_for_setitem(self, ckey, chunk_selection, value, fields=None):
return self._encode_chunk(chunk)

def _chunk_key(self, chunk_coords):
return self._key_prefix + '.'.join(map(str, chunk_coords))
if hasattr(self._store, 'key_separator'):
Copy link
Member

Choose a reason for hiding this comment

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

A heads up that #716 deprecates key_separator in favor store._dimension_separator. Looking at this usage, I imagine wrapping stores like LRUCacheStore and ConsolidatedMetadataStore are going to need to set `_dimension_separator as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, thanks for letting me know. Should we hold off on this PR until #716 is in and then revisit?

Copy link
Member

Choose a reason for hiding this comment

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

Nah, let's get this out as a point release. Just a warning that this "API" will change. It's all kismet.

Copy link
Contributor

@d-v-b d-v-b Apr 29, 2021

Choose a reason for hiding this comment

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

The behavior of _chunk_key should not be changed here. Instead, the behavior of FSStore.getitems should be changed to properly remap the keys. See https://github.com/zarr-developers/zarr-python/pull/709/files#diff-565e487a2f60258b6baa2e4db8ef175cc16b8a949651834bd43d0a9f21e07358R1054

@@ -1950,7 +1950,11 @@ def _process_for_setitem(self, ckey, chunk_selection, value, fields=None):
return self._encode_chunk(chunk)

def _chunk_key(self, chunk_coords):
return self._key_prefix + '.'.join(map(str, chunk_coords))
if hasattr(self._store, 'key_separator'):
Copy link
Member

Choose a reason for hiding this comment

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

Nah, let's get this out as a point release. Just a warning that this "API" will change. It's all kismet.

@d-v-b
Copy link
Contributor

d-v-b commented Apr 29, 2021

This PR needs to be reverted, since the solution in this PR breaks the abstraction boundary between array and chunk store, and the problem this PR solves is addressed in #709 by changes to FSStore, which is the correct level of abstraction for this fix.

@joshmoore
Copy link
Member

Thanks, @d-v-b. And sorry for the troubles. If you haven't already, can you capture the test from here in #709?

joshmoore added a commit to joshmoore/zarr-python that referenced this pull request Apr 29, 2021
@joshmoore
Copy link
Member

see #729

jakirkham pushed a commit that referenced this pull request Apr 29, 2021
joshmoore added a commit to d-v-b/zarr-python that referenced this pull request Apr 30, 2021
joshmoore added a commit to d-v-b/zarr-python that referenced this pull request Apr 30, 2021
joshmoore added a commit that referenced this pull request May 19, 2021
* FSStore: aflesh out incomplete test and add another. The first test passes after changes to FSStore. The second test fails.

* pep8 fixes

* TestNestedFSStore: tweak second assertion of test_numbered_groups

* FSStore: change ggetitems to return dict with input keys

* TestArrayWithFSStore: add key_separator kwarg FSStore constructor

* TestArrayWithFSStore: add key_separator arg to store constructor in create_arrray.

* revert changes. the logic I need to test actually lives in test_core, not test_storage.

* kill some whitespace

* add nested tfsstore tests

* FSStore: fsstore.listdir now handles nested keys

* FSStore: re-order conditional evaluation in listdir

* FSStore: use self.fs.find in listdir

* Add tests from #718

* Apply suggestion from @grlee77

* Update PartialRead hexdigest values

* More hexdigest updates

Co-authored-by: jmoore <josh@glencoesoftware.com>
@joshmoore joshmoore mentioned this pull request Feb 9, 2022
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Array._chunk_key does not respect FSStore's key_separator attribute
3 participants