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

WIP: Beam executor without writing to temporary arrays #36

Closed
wants to merge 1 commit into from

Conversation

shoyer
Copy link
Collaborator

@shoyer shoyer commented Jul 30, 2020

This isn't ready for a full review yet since it doesn't have any tests -- I
haven't even run the code.

This isn't ready for a full review yet since it doesn't have any tests -- I
haven't even run the code.
@codecov
Copy link

codecov bot commented Jul 30, 2020

Codecov Report

Merging #36 into master will decrease coverage by 8.65%.
The diff coverage is 46.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #36      +/-   ##
==========================================
- Coverage   93.39%   84.74%   -8.66%     
==========================================
  Files           7        7              
  Lines         318      367      +49     
  Branches       65       76      +11     
==========================================
+ Hits          297      311      +14     
- Misses         10       44      +34     
- Partials       11       12       +1     
Impacted Files Coverage Δ
rechunker/executors/beam.py 67.04% <46.29%> (-32.96%) ⬇️
rechunker/algorithm.py 75.38% <0.00%> (-9.24%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 22e6ca0...ebee4da. Read the comment docs.

shoyer added a commit to shoyer/rechunker that referenced this pull request Jul 31, 2020
I originally thought that it made the most sense to think of rechunking as a
chain of chunked array copies.

After going through the exercise of trying to write an Executor that doesn't
use temporary arrays (pangeo-data#36), I
realize now that this was overly generic. *Sometimes* it might make sense to
implement a rechunking this way, but Rechunker's algorithm adds more structure
than that. There is always a "push/pull" structure that splits read chunks into
intermediate chunks, and then combines intermediate chunks into write chunks.

This structure wasn't evident from current data model and I needed it for my
executor without temporaries, so this PR changes CopySpec to directly keep
track of "read/intermediate/write" steps.

It's still convenient sometimes to use the "chain of copies" representation,
so I've added the utility function `split_into_direct_copies()` for converting
to this representation in `rechunker.executors.util`.
@shoyer shoyer mentioned this pull request Jan 1, 2021
7 tasks
@shoyer
Copy link
Collaborator Author

shoyer commented May 15, 2021

I'm going to close this. We implemented a variant of this executor inside xarray-beam (but on whole xarray datasets instead of numpy arrays):
https://github.com/google/xarray-beam/blob/0.0.1/xarray_beam/_src/rechunk.py

That would be a good starting point if anyone wants to revisit this.

In practice, Beam does seem to typically write out intermediate chunks to temporary storage, but it's still nice to have the whole thing in via Beam transforms, especially for composing into larger pipelines (e.g., Read Zarr -> Rechunk -> Calculate something -> Rechunk -> Write to Zarr)

@shoyer shoyer closed this May 15, 2021
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.

1 participant