Refactor async datatree loading to reuse open_groups_as_dict_async
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
Summary
Follow-up from PR #10742 (async DataTree loading optimization). As suggested by @keewis in the PR review:
logically I think
xr.open_datatree(...) == xr.DataTree.from_dict(xr.open_groups(...)), so it might make sense to have_open_datatree_asynccall_open_groups_as_dict_async
Current State
After #10742, the zarr backend has two similar async implementations:
_open_datatree_from_stores_async()- used byopen_datatree()open_groups_as_dict_async()- used byopen_groups()
Both do similar work but with some differences:
- Semaphore usage for concurrency control
- Index creation handling
Proposed Change
Refactor _open_datatree_from_stores_async to internally call open_groups_as_dict_async, reducing code duplication and ensuring consistent behavior between the two APIs.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the async entry points _open_datatree_from_stores_async and open_groups_as_dict_async, then review PR #10742 for the existing optimization context. Compare their semaphore and index-creation handling, and verify that datatree loading delegates through the groups-as-dict path with consistent behavior between the two APIs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100