Repository navigation
chunkmirage materialize: a dataset written to a store as the server serves it - #40
Merged
Merged
Conversation
#39's Engine.materialize: a pipeline, or a box of it, computed and written into a store (a directory, file://, gs:// or s3://, through tensorstore's kvstore) as a frontend serves it, zarr v3 with OME-Zarr 0.5, zarr v2 with OME-Zarr 0.4 (consolidated) or N5, the metadata and each chunk byte for byte what a client fetches, so the store reads back as a stored dataset of its own (a registration's pass computed once, then read from disk); every level's metadata first, so a store stopped part way is still the dataset, then the chunks of the levels asked for, several at once (demand.gather, in batches), those of nothing but zeros left out unless asked for; --box takes level 0's voxels along the last axes and every level writes the same region rounded out to whole chunks; frontends say where a chunk is served (chunk_key: zarr3, zarr2 and N5); the tests write all three formats and read them back as they were served, and a box of one level from the command line; docs: formats (a section beside the browser engine's), CLI and API references, design's core table, contributing's plugin API, the roadmap's item 2 (a first piece in both engines), CHANGELOG
…ather than read it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Python side of #39's
Engine.materialize: a dataset, or a box of it, computed and written into a store as a frontend serves it, so it reads back as a stored dataset of its own. registration-station's use is the first: a pass computed once per round (about 5 minutes for the s3 stage on an A100), then read from disk instead of computed again.and
chunkmirage.materialize(pipeline, where, format=, levels=, box=, compressor=, skip_empty=, progress=)for any pipeline, a chain of datasets throughdataset://among them (registry.get(name)).What it writes. The frontend's own metadata and encoded chunks (
resolveandencode, as the server answers a request), so a zarr v3 (OME-Zarr 0.5), zarr v2 (OME-Zarr 0.4, consolidated) or N5 store is byte for byte what a client fetches, compressed as the server compresses (blosc for zarr, gzip for N5,--compressorotherwise). Frontends gainchunk_key(level, index), the path a chunk is served at; the precomputed and mesh frontends have none, so they are not offered. The store is anything tensorstore's kvstore writes: a directory, or afile://,gs://ors3://URL.In what order. Every level's metadata first, so a store whose writing stopped part way is still the dataset, zero where no chunk was written yet; then the chunks of the levels asked for (all by default), in batches of 256 computed at once through #38's
demand.gather; a chunk of nothing but zeros is left out (a reader takes a missing chunk as the fill value) unless--keep-empty.--boxtakes level 0's voxels along the last axes, and each level writes the same region on its own voxels, rounded out to whole chunks.Not here. The browser's background class (#39) matters only when a region is written inside a server someone is browsing; a write from the command line or a script needs none, and inside a running server this competes with clients as any work asked for from Python does (never dropped, in arrival order), its chunks passing through the server's cache. The cache on disk that browsing fills (roadmap item 2) is still to do.
Tests (
tests/test_materialize.py, 4): a warp shifted past its image's edge written as zarr v3, zarr v2 and N5, every chunk counted written or skipped (the ones past the edge skipped) and each level read back with the served shape, voxel size, dtype and values; and from the command line, a box of level 1 only, one chunk written and the rest of the store zeros.Docs:
concepts/formats.md(a section beside the browser engine's),reference/cli.md(the command),reference/api.md,design.md(the core's table),contributing.md(the plugin API),roadmap.md(item 2: a first piece in both engines),CHANGELOG.md. Checks:pytest(322 passed),ruff,mkdocs build --strict;chunkmirage schemaunchanged;web/untouched.