Skip to content

Add DataTree.persist - #9682

Merged
shoyer merged 6 commits into
pydata:mainfrom
slevang:datatree-persist
Oct 28, 2024
Merged

Add DataTree.persist#9682
shoyer merged 6 commits into
pydata:mainfrom
slevang:datatree-persist

Conversation

@slevang

@slevangslevang commented Oct 25, 2024

Copy link
Copy Markdown
Contributor

Also switches the underlying persist calls to be handled by ChunkManagerEntrypoint. Only implemented on the DaskManager so it's not an abstract method.

  • ClosesImplement DataTree.persist #9675
  • Tests added
  • User visible changes (including notable bug fixes) are documented in whats-new.rst
  • New functions/methods are listed in api.rst

@TomNicholasTomNicholas added topic-DataTree Related to the implementation of a DataTree class topic-dask labels Oct 25, 2024

@TomNicholasTomNicholas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Amazing, no notes!

Comment threadxarray/core/datatree.py Outdated
Comment on lines +2007 to +2008
# evaluate all the dask arrays simultaneously
evaluated_data = dask.persist(*flat_lazy_data.values(), **kwargs)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually I lied - there is a least a ToDo to be noted here that this should be routed through the chunkmanager. The chunkmanager doesn't have persist at the moment, but it should, even if dask is the only one to implement it.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Sure, I just copied dataset persist, which looks like it hasn't been touched since long before the chunkmanager was introduced.

Should we add persist here as a non-abstract method on the chunkmanager classes? Looks pretty straightforward.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes that would be great

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Technically it could be a separate PR (pre-requisite to this one) but it's not super important to split them.

@TomNicholasTomNicholas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

excellent!

@shoyer
shoyer merged commit 0c6cded into pydata:mainOct 28, 2024
@shoyer

Copy link
Copy Markdown
Member

thanks @slevang !

dcherian added a commit to dcherian/xarray that referenced this pull request Oct 29, 2024
* main:
Add `DataTree.persist` (pydata#9682)
Typing annotations for arithmetic overrides (e.g., DataArray + Dataset) (pydata#9688)
Raise `ValueError` for unmatching chunks length in `DataArray.chunk()` (pydata#9689)
Fix inadvertent deep-copying of child data in DataTree (pydata#9684)
new blank whatsnew (pydata#9679)
v2024.10.0 release summary (pydata#9678)
drop the length from `numpy`'s fixed-width string dtypes (pydata#9586)
fixing behaviour for group parameter in `open_datatree` (pydata#9666)
Use zarr v3 dimension_names (pydata#9669)
fix(zarr): use inplace array.resize for zarr 2 and 3 (pydata#9673)
implement `dask` methods on `DataTree` (pydata#9670)
support `chunks` in `open_groups` and `open_datatree` (pydata#9660)
Compatibility for zarr-python 3.x (pydata#9552)
Update to_dataframe doc to match current behavior (pydata#9662)
Reduce graph size through writing indexes directly into graph for ``map_blocks`` (pydata#9658)
dcherian added a commit to dcherian/xarray that referenced this pull request Nov 3, 2024
* main: (85 commits)
Refactor out utility functions from to_zarr (pydata#9695)
Use the same function to floatize coords in polyfit and polyval (pydata#9691)
Add `DataTree.persist` (pydata#9682)
Typing annotations for arithmetic overrides (e.g., DataArray + Dataset) (pydata#9688)
Raise `ValueError` for unmatching chunks length in `DataArray.chunk()` (pydata#9689)
Fix inadvertent deep-copying of child data in DataTree (pydata#9684)
new blank whatsnew (pydata#9679)
v2024.10.0 release summary (pydata#9678)
drop the length from `numpy`'s fixed-width string dtypes (pydata#9586)
fixing behaviour for group parameter in `open_datatree` (pydata#9666)
Use zarr v3 dimension_names (pydata#9669)
fix(zarr): use inplace array.resize for zarr 2 and 3 (pydata#9673)
implement `dask` methods on `DataTree` (pydata#9670)
support `chunks` in `open_groups` and `open_datatree` (pydata#9660)
Compatibility for zarr-python 3.x (pydata#9552)
Update to_dataframe doc to match current behavior (pydata#9662)
Reduce graph size through writing indexes directly into graph for ``map_blocks`` (pydata#9658)
Add close() method to DataTree and use it to clean-up open files in tests (pydata#9651)
Change URL for pydap test (pydata#9655)
Fix multiple grouping with missing groups (pydata#9650)
...
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic-dasktopic-DataTreeRelated to the implementation of a DataTree class

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement DataTree.persist

3 participants

@slevang@shoyer@TomNicholas