|
30 | 30 | _build_parents,
|
31 | 31 | _parse_deprecated_compressor,
|
32 | 32 | create_array,
|
33 |
| - is_concurrency_safe, |
34 | 33 | )
|
35 | 34 | from zarr.core.attributes import Attributes
|
36 | 35 | from zarr.core.buffer import default_buffer_prototype
|
@@ -534,23 +533,17 @@ async def open(
|
534 | 533 | if zarr_json_bytes is None:
|
535 | 534 | raise FileNotFoundError(store_path)
|
536 | 535 | elif zarr_format is None:
|
537 |
| - paths = [ |
538 |
| - (store_path / ZARR_JSON).get(), |
539 |
| - (store_path / ZGROUP_JSON).get(), |
540 |
| - (store_path / ZATTRS_JSON).get(), |
541 |
| - (store_path / consolidated_key).get(), |
542 |
| - ] |
543 | 536 | (
|
544 | 537 | zarr_json_bytes,
|
545 | 538 | zgroup_bytes,
|
546 | 539 | zattrs_bytes,
|
547 | 540 | maybe_consolidated_metadata_bytes,
|
548 |
| - ) = ( |
549 |
| - await asyncio.gather(*paths) |
550 |
| - if is_concurrency_safe(store_path.store) |
551 |
| - else [await path for path in paths] |
| 541 | + ) = await store_path.get_many( |
| 542 | + ZARR_JSON, |
| 543 | + ZGROUP_JSON, |
| 544 | + ZATTRS_JSON, |
| 545 | + consolidated_key, |
552 | 546 | )
|
553 |
| - |
554 | 547 | if zarr_json_bytes is not None and zgroup_bytes is not None:
|
555 | 548 | # warn and favor v3
|
556 | 549 | 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."
|
@@ -3461,23 +3454,11 @@ async def _read_metadata_v2(store: Store, path: str) -> ArrayV2Metadata | GroupM
|
3461 | 3454 | # TODO: consider first fetching array metadata, and only fetching group metadata when we don't
|
3462 | 3455 | # find an array
|
3463 | 3456 | print(f"Reading metadata from {path} in store {store}", file=sys.stderr)
|
3464 |
| - if is_concurrency_safe(store): |
3465 |
| - zarray_bytes, zgroup_bytes, zattrs_bytes = await asyncio.gather( |
3466 |
| - store.get(_join_paths([path, ZARRAY_JSON]), prototype=default_buffer_prototype()), |
3467 |
| - store.get(_join_paths([path, ZGROUP_JSON]), prototype=default_buffer_prototype()), |
3468 |
| - store.get(_join_paths([path, ZATTRS_JSON]), prototype=default_buffer_prototype()), |
3469 |
| - ) |
3470 |
| - else: |
3471 |
| - zarray_bytes = await store.get( |
3472 |
| - _join_paths([path, ZARRAY_JSON]), prototype=default_buffer_prototype() |
3473 |
| - ) |
3474 |
| - zgroup_bytes = await store.get( |
3475 |
| - _join_paths([path, ZGROUP_JSON]), prototype=default_buffer_prototype() |
3476 |
| - ) |
3477 |
| - zattrs_bytes = await store.get( |
3478 |
| - _join_paths([path, ZATTRS_JSON]), prototype=default_buffer_prototype() |
3479 |
| - ) |
3480 |
| - |
| 3457 | + zarray_bytes, zgroup_bytes, zattrs_bytes = await asyncio.gather( |
| 3458 | + store.get(_join_paths([path, ZARRAY_JSON]), prototype=default_buffer_prototype()), |
| 3459 | + store.get(_join_paths([path, ZGROUP_JSON]), prototype=default_buffer_prototype()), |
| 3460 | + store.get(_join_paths([path, ZATTRS_JSON]), prototype=default_buffer_prototype()), |
| 3461 | + ) |
3481 | 3462 | if zattrs_bytes is None:
|
3482 | 3463 | zattrs = {}
|
3483 | 3464 | else:
|
|
0 commit comments