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

weather-mv will ingest data into BQ from Zarr much faster. #357

Merged
merged 31 commits into from
Aug 16, 2023
Merged

Conversation

alxmrs
Copy link
Collaborator

@alxmrs alxmrs commented Jul 11, 2023

weather-mv bq's previous Zarr ingestion system only used one worker. This PR uses Xarray-Beam for Zarr ingestion, in order to distributed xr.Dataset chunks across beam workers. This improves ingestion into BQ.

Outstanding issues: I can't find a way to incrementally load rows into BQ from Zarr. While I've used windowing on fixed intervals to break up a large ingestion job into smaller parts, it seems like the actual writing to BQ gets stuck in a reshuffle step within the WriteToBigQuery transform. In this PR or a future PR, let's try to find a way to incrementally write rows to BQ once they've been processed, instead of having to wait for the entire dataset to be processed. CC: @dabhicusp.

@alxmrs alxmrs requested a review from dabhicusp July 11, 2023 17:26
@alxmrs alxmrs requested a review from mahrsee1997 July 11, 2023 17:26
Copy link
Collaborator

@mahrsee1997 mahrsee1997 left a comment

Choose a reason for hiding this comment

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

Overall LGTM.

@dabhicusp / @DarshanSP19, could you please provide the benchmarking results for the current main branch as compared to this specific branch?

paths
| 'OpenChunks' >> xbeam.DatasetToChunks(ds, chunks)
| 'ExtractRows' >> beam.FlatMapTuple(self.chunks_to_rows)
| 'Window' >> beam.WindowInto(window.FixedWindows(60))
Copy link
Collaborator

@mahrsee1997 mahrsee1997 Jul 17, 2023

Choose a reason for hiding this comment

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

If incorporating these steps (window) enables real-time data ingestion into BigQuery (in batch jobs), then we should relocate these lines here.
Ref: #291

Copy link
Collaborator

@dabhicusp dabhicusp left a comment

Choose a reason for hiding this comment

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

LGTM @alxmrs.

@DarshanSP19
Copy link
Collaborator

DarshanSP19 commented Jul 19, 2023

Data after running pipelines for mentioned cases.

File Size main branch mv-ba-fix-zarr (this branch)
~100Mb 58 min. 41min.
~1Gb 16h 30min. 1h 12min.

This changes are relatively fast than before for zarr batch ingestion.

@alxmrs alxmrs requested a review from mahrsee1997 July 21, 2023 04:08
@alxmrs alxmrs merged commit 9cdf0e7 into main Aug 16, 2023
5 checks passed
@alxmrs alxmrs deleted the mv-ba-fix-zarr branch August 16, 2023 19:03
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.

5 participants