Repository navigation
API: provides method to compute unknown chunks sizes - #5312
Conversation
|
I also added a flag to
I'd expect |
|
I'm getting some CI errors on importing: I'm getting the same errors on my local machine. |
|
I think that's related to the |
5302873 to
734cc29
Compare
|
Thanks @jrbourbeau! That fixed the error. I think there's some future work to do on naming. |
|
Looks like all tests are passing now 🎉 But a |
|
I've done some renaming. Now, the chunk sizes can be computed with |
|
Thanks for your work here @stsievert, I'll give this a more thorough review tomorrow |
jrbourbeau
left a comment
There was a problem hiding this comment.
Thanks again for working on this @stsievert, looking forward to seeing this PR merged. Overall, these additions looks good! I've attached a few review comments.
I think the main thing left to do is to determine a name for the new method (e.g. compute_metadata vs. compute_chunksizes) and decide if we want to add a new compute_metadata (or some other name) parameter to the Array.persist method. @mrocklin previously you were hesitant to add parameters to persist that weren't general to all dask collections, is this still the case?
Also, @stsievert once we finalize a method name could you it to the array API docs?
|
cc @jakirkham |
If it's ok I'm a little low on mental energy at the moment. I'd appreciate it if some of the other maintainers could take on responsibility for this decision. @jakirkham is off this week. I usually ping @jcrist when it comes to the dask.base API, and matters of consistency. |
|
Thanks for the review @jrbourbeau! This PR is on hold until after Labor Day; I’m out this week. I’ll clean up this PR after that (and respond to the other comments you left).
Can do. I think a bigger documentation note should also be included; I’ll try to add that, possibly in a separate PR. |
|
I've responded to the review and cleaned a bit.
I don't know if I'd expect that. The documentation for
I think I'd support adding a |
mrocklin
left a comment
There was a problem hiding this comment.
Thanks @stsievert ! I left a few tiny comments, but hopefully everything is straightforward.
|
Thanks for the review @mrocklin! I should have caught some of those comments earlier – sorry 'bout that. I changed the name again – |
|
I've implemented suggestions to use >>> x = da.from_array([-1, 0, 1], chunks=1)
>>> y = x[x >= 0]
>>> y.rechunk("auto")
ValueError: Can not perform automatic rechunking with unknown (nan) chunk sizes.
A possible solution is with
x.compute_chunk_sizes()
>>> y = y.compute_chunk_sizes()
>>> y.rechunk("auto")
dask.array<rechunk-merge, shape=(2,), dtype=int64, chunksize=(2,), chunktype=numpy.ndarray>I currently add this snippet to error messages for |
|
I think I'd expect it to modify the Dask array in place – the side effect of Pragmatically, I'm not sure this matters because Dask arrays are immutable: Lines 2183 to 2185 in 973c6e1 |
TomAugspurger
left a comment
There was a problem hiding this comment.
Looks good overall. Can you add a note to https://docs.dask.org/en/latest/array-chunks.html#unknown-chunks and an api entry in https://docs.dask.org/en/latest/array-api.html.
If you're interested, it'd be nice to be more consistent on the error message. Some of "Solution in", others have "A solution in". Some have colons.
|
I think it's worth adding a test for a 3d or anything n > 2 array |
|
Thanks @stsievert! |
What does this PR implement?
It provides a method to compute unknown chunk sizes:
References issues/PRs
black dask/flake8 dask