fix chunk/shard iteration#3299
Conversation
…nd add a failing test
Co-authored-by: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
| return self.chunk_grid_shape | ||
|
|
||
| @property | ||
| def chunk_grid_shape(self) -> ChunkCoords: |
There was a problem hiding this comment.
I added a new property called chunk_grid_shape because cdata_shape is ambiguous. cdata_shape is still around, but it now uses chunk_grid_shape
| return tuple(starmap(ceildiv, zip(self.shape, self.chunks, strict=True))) | ||
|
|
||
| @property | ||
| def shard_grid_shape(self) -> ChunkCoords: |
There was a problem hiding this comment.
this complements chunk_grid_shape.
…nto fix/_iter_chunk_keys
|
Ooh, that looks like a much more complete implementation of what I did in that other PR! Kudos; I wouldn't have been able to push things this far ✨✨ |
It turned out to be more than I expected 😅 . |
| raise NotImplementedError(msg) | ||
|
|
||
|
|
||
| def iter_regions( |
There was a problem hiding this comment.
this is a new function for iterating over contiguous regions. When we support irregular chunking, we can overload the type of region_shape accordingly.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3299 +/- ##
==========================================
+ Coverage 94.62% 94.69% +0.07%
==========================================
Files 79 79
Lines 9468 9520 +52
==========================================
+ Hits 8959 9015 +56
+ Misses 509 505 -4
🚀 New features to boost your workflow:
|
|
Just to make sure we're on the same page here, this is where we're heading in my mind, as something that can go in the user guide:
|
dcherian
left a comment
There was a problem hiding this comment.
LGTM. I have some concerns about better testing these functions, but they can be addressed later.
|
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove the If these instructions are inaccurate, feel free to suggest an improvement. |
In
mainthere are some routines for iterating over the chunks of an array, but these routines do not distinguish between chunks and shards (i.e., stored objects) for arrays with sharding.This PR adds a separate set of shard-specific iteration routines to complement our chunk-specific iteration routines. Various bugs related to iterating over chunks, when shards were the intended iteration target, have been fixed by these changes, notably bugs causing memory races when creating arrays via
create_array(xref ##3169)I think this supersedes #3217, @bojidar-bg I credited you as a co-author on one of these commits because your idea to change the iteration from chunks to shards was correct.