fractal-analytics-platform / fractal-tasks-core

Main tasks for the Fractal analytics platform
https://fractal-analytics-platform.github.io/fractal-tasks-core/
BSD 3-Clause "New" or "Revised" License
14 stars 6 forks source link

Replace loading `.zattrs` file with accessing zarr attrs #501

Closed tcompa closed 1 year ago

tcompa commented 1 year ago

We currently do it at least in the following cases:

$ git grep -n "with open(" | grep zattr

lib_zattrs_utils.py:36:    with open(zattrs_path, "r") as jsonfile:
tasks/cellpose_segmentation.py:397:    with open(zattrs_file, "r") as jsonfile:
tasks/cellpose_segmentation.py:430:        with open(f"{zarrurl}/labels/.zattrs", "r") as f_zattrs:
tasks/napari_workflows_wrapper.py:200:    with open(zattrs_file, "r") as jsonfile:
tasks/napari_workflows_wrapper.py:431:            with open(f"{zarrurl}/labels/.zattrs", "r") as f_zattrs:

while it'd be more general to directly access the attrs of a zarr group, rather than depending on a specific on-disk storage.

jluethi commented 1 year ago

Very good idea to shift this to the zarr group! Feel free to tag that in the registration PR as well, there may be one or another of those there as well :)

tcompa commented 1 year ago

After #528, this issue will appear only in a few places.

EDIT: as of c44ef38, all three points are fixed.

tcompa commented 1 year ago

A small fix to the cellpose was still missing. Done with 3d62b29.