Adding copy_store convenience method for Group#3612
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3612 +/- ##
=======================================
Coverage 93.52% 93.52%
=======================================
Files 90 90
Lines 11926 11962 +36
=======================================
+ Hits 11154 11188 +34
- Misses 772 774 +2
🚀 New features to boost your workflow:
|
|
@d-v-b I know right now this won't work when zarr v2 is used. I can add that functionality as well or we say the convenience function is not supported for zarr v2. |
|
added zarr v2 support. If in general the code is approved, I will add documentation. |
| store: StoreLike, | ||
| *, | ||
| overwrite: bool = False, | ||
| consolidate_metadata: bool | None = None, |
There was a problem hiding this comment.
why do we need this here? IMO it's simpler if copying is just copying. If people want to add consolidated metadata, they should do that after copying.
There was a problem hiding this comment.
adjusted it. It now consolidates if the source store was consolidated, but this does not require an argument. One more thing, I only take into account when consolidation happened at the root level. It could be (although the user should not do this) that consolidation happened at the subgroup level. This could be accounted for by checking if member. metadata.consolidated_metadata when looping through members. WDYT should I add this?
There was a problem hiding this comment.
I would copy the original group and its children exactly, including their consolidated metadata.
There was a problem hiding this comment.
What would be the purpose of copying over stale consolidated metadata?
There was a problem hiding this comment.
it keeps the scope of this function simple -- it just copies the original group exactly. If this tool produces a different group, then it's not really copying.
There was a problem hiding this comment.
regarding the from_store method, I would open a separate PR for this.
There was a problem hiding this comment.
Consolidated metadata is already in the group metadata document for zarr v3 if "kind" is set to "inline".
👍 but doing something other (more or less) than just copying would require interpreting that which is too far IMO.
There was a problem hiding this comment.
FYI @joshmoore the method under discussion here is a method on the Group class, not on stores. maybe this is a point of confusion.
There was a problem hiding this comment.
IMO the only consolidated metadata-related parameter we need is whether iterating over the child groups uses their consolidated metadata (if present). See the relevant kwarg in the signature of members.
There was a problem hiding this comment.
I added both, only thing remaining is probably adding consolidated_metadata in the async group call.
|
@d-v-b @joshmoore I think I have now addressed all comments and I also added documentation, so I think this would be ready for a final round of review. @d-v-b thanks for your patience. |
|
@d-v-b @joshmoore , just bumping in case you have some time to see whether you approve the current state:) |
|
@d-v-b When the last test passes and if you are happy with the code changes I think this is good to go. Thanks for reviewing! |
|
@melonora I just realized that this implementation is decoding and re-encoding array chunks. Was there a particular reason for that choice? Because it would be far faster to copy the bytes directly |
|
Hmm, mostly a lack of familiarity with getting the raw bytes, but looking at the documentation, I should be able to do something like |
|
you don't have to! I already did in a local branch. If it's OK with you, I would push those changes here. |
|
Ah ok, thanks! Yes I am ok with it. |
|
@d-v-b is this still of interest? I could resolve the conflicts or otherwise close it. |
|
it is, sorry for the delay in dealing with things here. lmk if you run into any trouble with the merge conflicts |
|
will do, thanks! |
|
@d-v-b if you are ok with the current state, it can be merged |
|
@melonora I'm going to give this a careful look today. I might identify some things in this PR that would be better off implemented in separate parts of the zarr codebase, do you mind if I push to your branch? some changes would come in that way, others might be spun off into separate PRs |
[Description of PR]
This PR adds a convenience method for copying the store of a
Groupto a destination store.TODO:
docs/user-guide/*.mdchanges/@d-v-b