Skip to content

Regression with Zarr: ReadOnlyError #135

@rabernat

Description

@rabernat

Tests with the latest dev environment are failing with errors like this


tmp_path = PosixPath('/private/var/folders/kl/7rfdrpx96bb0rhbnl5l2dnkw0000gn/T/pytest-of-rabernat/pytest-69/test_rechunk_group_mapper_temp7')
executor = 'python', source_store = 'mapper.source.zarr', target_store = <fsspec.mapping.FSMap object at 0x1174e3520>
temp_store = <fsspec.mapping.FSMap object at 0x1174e3400>

    @pytest.mark.parametrize(
        "executor",
        [
            "dask",
            "python",
            requires_beam("beam"),
            requires_prefect("prefect"),
        ],
    )
    @pytest.mark.parametrize("source_store", ["source.zarr", "mapper.source.zarr"])
    @pytest.mark.parametrize("target_store", ["target.zarr", "mapper.target.zarr"])
    @pytest.mark.parametrize("temp_store", ["temp.zarr", "mapper.temp.zarr"])
    def test_rechunk_group(tmp_path, executor, source_store, target_store, temp_store):
        if source_store.startswith("mapper"):
            fsspec = pytest.importorskip("fsspec")
            store_source = fsspec.get_mapper(str(tmp_path) + source_store)
            target_store = fsspec.get_mapper(str(tmp_path) + target_store)
            temp_store = fsspec.get_mapper(str(tmp_path) + temp_store)
        else:
            store_source = str(tmp_path / source_store)
            target_store = str(tmp_path / target_store)
            temp_store = str(tmp_path / temp_store)
    
>       group = zarr.group(store_source)

tests/test_rechunk.py:457: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../mambaforge/envs/rechunker/lib/python3.9/site-packages/zarr/hierarchy.py:1355: in group
    init_group(store, overwrite=overwrite, chunk_store=chunk_store,
../../../mambaforge/envs/rechunker/lib/python3.9/site-packages/zarr/storage.py:648: in init_group
    _init_group_metadata(store=store, overwrite=overwrite, path=path,
../../../mambaforge/envs/rechunker/lib/python3.9/site-packages/zarr/storage.py:711: in _init_group_metadata
    store[key] = store._metadata_class.encode_group_metadata(meta)  # type: ignore
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <zarr.storage.FSStore object at 0x1174e34c0>, key = '.zgroup', value = b'{\n    "zarr_format": 2\n}'

    def __setitem__(self, key, value):
        if self.mode == 'r':
>           raise ReadOnlyError()
E           zarr.errors.ReadOnlyError: object is read-only

../../../mambaforge/envs/rechunker/lib/python3.9/site-packages/zarr/storage.py:1410: ReadOnlyError
==

This is the cause of the test failures in #134.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions