Repository navigation
Read missing annexed content with datalad-fuse, cached by annex key - #1955
Draft
CodyCBakerPhD wants to merge 6 commits into
Draft
CodyCBakerPhD wants to merge 6 commits into
CodyCBakerPhD wants to merge 6 commits into
Conversation
Add `dandi.support.datalad_fuse.AnnexedReadableFile`, a `Readable` for a locked annexed file whose content is not present locally, streamed with the adapter of datalad-fuse (no FUSE mount), which asks git-annex where the content is. It is available with the new `datalad` extra. Cache NWB metadata of locked annexed files, streamed or local, under their git-annex key paired with their path, with fscacher 0.5.0's `annex_key_fingerprint`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qn5WBSiQgoZoL4fytF6nEr
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1955 +/- ##
==========================================
+ Coverage 90.73% 90.86% +0.12%
==========================================
Files 92 94 +2
Lines 14130 14381 +251
==========================================
+ Hits 12821 13067 +246
- Misses 1309 1314 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
annex_fingerprint is not specific to NWB files, and living in dandi.support.datalad_fuse it needs no deferred import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qn5WBSiQgoZoL4fytF6nEr
As documented in datalad/datalad-fuse#138. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qn5WBSiQgoZoL4fytF6nEr
fscacher imports joblib, which imports numpy, so importing it with the module made the CLI (via dandi.validate in the stacked PR) import numpy, failing test_no_heavy_imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qn5WBSiQgoZoL4fytF6nEr
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qn5WBSiQgoZoL4fytF6nEr
h5py holds its global lock while reading from a Python file object, and the read waits for another thread to fetch the data over HTTP (fsspec's I/O thread, or an HTTP server in the same process as in the tests). A garbage collection in that thread could then run the finalizer of an unreferenced h5py-backed object (e.g., hdmf's HDF5IO.__del__), which waits for the same lock: a deadlock, as seen in CI in test_validate_stream, ended by pytest-timeout with a segfault. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qn5WBSiQgoZoL4fytF6nEr
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.
This PR and the one stacked on it are an alternative to #1941 and #1933. They build on datalad-fuse 0.5.1, the current PyPI release, instead of a git-only reader of the
git-annexbranch. The goal is the same:dandi validateon a DataLad clone of a Dandiset, streaming file content without downloading it.Changes
dandi.support.datalad_fuse.AnnexedReadableFileis aReadablefor a locked annexed file whose content isn't present locally.FsspecAdapter(no FUSE mount,caching=False). The adapter asks git-annex where the content is (whereis) and reads it over HTTP(S) with fsspec.get_annexed_readable(path)returnsNonein any of these cases:get_metadata,get_neurodata_typesandnwb_has_external_linksuse the newpynwb_utils.annex_fingerprintas theircustom_fingerprint.annex_key_fingerprint, which keys on the path paired with the annex key.WORMandURLkeys fall back tostat().Readable.dataladextra:datalad-fuse >= 0.5.1, which also requires git-annex.fscacher >= 0.5.0.make_git_annex_dandiset()builds a real git-annex repository (content added, URL registered, then dropped).range_http_serverfixture serves files with range requests.skipif.no_git_annexcondition.mode: datalad, ubuntu, Python 3.12) installsgit-annexand.[datalad]from PyPI. The other jobs skip these tests.Compared to #1941
410 added lines against #1941's 990. It drops
AnnexKey,AnnexRepo, the URL-log parsing, the fake-annex fixtures and theReadable.get_fingerprinthook. In exchange, streaming requires git-annex and DataLad.🤖 Generated with Claude Code
https://claude.ai/code/session_01Qn5WBSiQgoZoL4fytF6nEr
Generated by Claude Code