I have a use case (writing complex, complete ome-zarr hierarchies using yaozarrs to generate and write all of the group nodes, with any array-writing library (zarr-python, tensorstore) to just write the actual array bytes. i.e. leave the hard performance-critical stuff to C++, but handle finicky metadata on the python side. I'm quite happy with the pattern, and would like to be able to use acquire-zarr with it.
This one line here causes me problems when I try to use the pattern with acquire-zarr (with specified ArraySettings.output_keys only to write the array-nodes)
|
} else { // generic group |
|
metadata_str = group_metadata.dump(4); |
|
} |
it results in acquire-zarr always writing an empty zarr.json group (over-writing whatever is there) for all intermediate directories required for ArraySettings.output_key relative to root. Moreover, because it happens later, it's not sufficient to just wait for acquire-zarr to write the file when creating the stream and then overwrite it (instead, you have to queue some function to run only after acquire-zarr has run its finalization logic).
my current workaround
# Backup complete zarr.json file structure prior to creating zarr stream
self._zarr_json_backup: dict[Path, bytes] = {}
stream = az.ZarrStream()
stream.close()
# later...
# Restore yaozarrs metadata that acquire-zarr overwrote
for path, content in self._zarr_json_backup.items():
path.write_bytes(content)
... however, that workaround is causing me problems on Windows, where I have so far been unable to get around Windows file-permissions write-access problems
Question:
@aliddell, would you consider a PR that either adds a public-facing option write_empty_groups
} else { // generic group
if (!write_empty_groups) {
continue;
}
metadata_str = group_metadata.dump(4);
}
... or just turns off the empty-group writing logic without a new public API? What would your preference be? new public API flag? or just continue.?
I have a use case (writing complex, complete ome-zarr hierarchies using yaozarrs to generate and write all of the group nodes, with any array-writing library (zarr-python, tensorstore) to just write the actual array bytes. i.e. leave the hard performance-critical stuff to C++, but handle finicky metadata on the python side. I'm quite happy with the pattern, and would like to be able to use acquire-zarr with it.
This one line here causes me problems when I try to use the pattern with acquire-zarr (with specified
ArraySettings.output_keys only to write the array-nodes)acquire-zarr/src/streaming/zarr.stream.cpp
Lines 1473 to 1475 in 80a3949
it results in acquire-zarr always writing an empty
zarr.jsongroup (over-writing whatever is there) for all intermediate directories required forArraySettings.output_keyrelative to root. Moreover, because it happens later, it's not sufficient to just wait for acquire-zarr to write the file when creating the stream and then overwrite it (instead, you have to queue some function to run only after acquire-zarr has run its finalization logic).my current workaround
... however, that workaround is causing me problems on Windows, where I have so far been unable to get around Windows file-permissions write-access problems
Question:
@aliddell, would you consider a PR that either adds a public-facing option
write_empty_groups... or just turns off the empty-group writing logic without a new public API? What would your preference be? new public API flag? or just
continue.?