|
31 | 31 | _build_parents, |
32 | 32 | _parse_deprecated_compressor, |
33 | 33 | create_array, |
34 | | - is_concurrency_safe, |
35 | 34 | ) |
36 | 35 | from zarr.core.attributes import Attributes |
37 | 36 | from zarr.core.buffer import default_buffer_prototype |
@@ -536,23 +535,17 @@ async def open( |
536 | 535 | if zarr_json_bytes is None: |
537 | 536 | raise FileNotFoundError(store_path) |
538 | 537 | elif zarr_format is None: |
539 | | - paths = [ |
540 | | - (store_path / ZARR_JSON).get(), |
541 | | - (store_path / ZGROUP_JSON).get(), |
542 | | - (store_path / ZATTRS_JSON).get(), |
543 | | - (store_path / consolidated_key).get(), |
544 | | - ] |
545 | 538 | ( |
546 | 539 | zarr_json_bytes, |
547 | 540 | zgroup_bytes, |
548 | 541 | zattrs_bytes, |
549 | 542 | maybe_consolidated_metadata_bytes, |
550 | | - ) = ( |
551 | | - await asyncio.gather(*paths) |
552 | | - if is_concurrency_safe(store_path.store) |
553 | | - else [await path for path in paths] |
| 543 | + ) = await store_path.get_many( |
| 544 | + ZARR_JSON, |
| 545 | + ZGROUP_JSON, |
| 546 | + ZATTRS_JSON, |
| 547 | + consolidated_key, |
554 | 548 | ) |
555 | | - |
556 | 549 | if zarr_json_bytes is not None and zgroup_bytes is not None: |
557 | 550 | # warn and favor v3 |
558 | 551 | msg = f"Both zarr.json (Zarr format 3) and .zgroup (Zarr format 2) metadata objects exist at {store_path}. Zarr format 3 will be used." |
@@ -3484,23 +3477,11 @@ async def _read_metadata_v2(store: Store, path: str) -> ArrayV2Metadata | GroupM |
3484 | 3477 | # TODO: consider first fetching array metadata, and only fetching group metadata when we don't |
3485 | 3478 | # find an array |
3486 | 3479 | print(f"Reading metadata from {path} in store {store}", file=sys.stderr) |
3487 | | - if is_concurrency_safe(store): |
3488 | | - zarray_bytes, zgroup_bytes, zattrs_bytes = await asyncio.gather( |
3489 | | - store.get(_join_paths([path, ZARRAY_JSON]), prototype=default_buffer_prototype()), |
3490 | | - store.get(_join_paths([path, ZGROUP_JSON]), prototype=default_buffer_prototype()), |
3491 | | - store.get(_join_paths([path, ZATTRS_JSON]), prototype=default_buffer_prototype()), |
3492 | | - ) |
3493 | | - else: |
3494 | | - zarray_bytes = await store.get( |
3495 | | - _join_paths([path, ZARRAY_JSON]), prototype=default_buffer_prototype() |
3496 | | - ) |
3497 | | - zgroup_bytes = await store.get( |
3498 | | - _join_paths([path, ZGROUP_JSON]), prototype=default_buffer_prototype() |
3499 | | - ) |
3500 | | - zattrs_bytes = await store.get( |
3501 | | - _join_paths([path, ZATTRS_JSON]), prototype=default_buffer_prototype() |
3502 | | - ) |
3503 | | - |
| 3480 | + zarray_bytes, zgroup_bytes, zattrs_bytes = await asyncio.gather( |
| 3481 | + store.get(_join_paths([path, ZARRAY_JSON]), prototype=default_buffer_prototype()), |
| 3482 | + store.get(_join_paths([path, ZGROUP_JSON]), prototype=default_buffer_prototype()), |
| 3483 | + store.get(_join_paths([path, ZATTRS_JSON]), prototype=default_buffer_prototype()), |
| 3484 | + ) |
3504 | 3485 | if zattrs_bytes is None: |
3505 | 3486 | zattrs = {} |
3506 | 3487 | else: |
|
0 commit comments