Skip to content

Prefetch the NEMAR sourcedata store in get_data() - #1148

Merged
bruAristimunha merged 2 commits into
developfrom
prefetch-nemar-store-in-get-data
Aug 21, 2026
Merged

Prefetch the NEMAR sourcedata store in get_data()#1148
bruAristimunha merged 2 commits into
developfrom
prefetch-nemar-store-in-get-data

Conversation

@bruAristimunha

Copy link
Copy Markdown
Collaborator

What

Follow-up to #1146, closing the last gap in its "not in scope" list (wiring the NEMAR sourcedata cache into get_data): the store is only filled by an explicit download() call, so a plain get_data() on a fresh machine still fetched from the upstream host even with the provider pinned to "nemar" — and get_data() is what every evaluation and benchmark actually calls.

get_data() now fetches the requested subjects' sourcedata/ into the store before loading, reusing sourcedata_path() and the provider policy download() already implements:

  • "upstream" — skips NEMAR entirely (unchanged behavior)
  • "nemar" — a NEMAR failure raises rather than silently reaching the host the caller opted out of
  • "auto" — warns per subject and leaves that subject to the dataset's own downloader

A non-empty store is trusted as-is and costs no network, preserving the warmed-store guarantee test_get_data_reads_the_nemar_store_end_to_end encodes (download(force_update=True) refreshes it).

Verification

Live on Nakanishi2015 (fresh caches, sample arrays hashed):

mode signal SHA hosts during get_data()
provider=upstream, plain get_data() a835e50de5aa42a9 github.com, raw.githubusercontent.com
develop: download()get_data() a835e50de5aa42a9 (none)
develop: plain get_data(), provider=nemar a835e50de5aa42a9 github.com ← the gap
this PR: plain get_data(), provider=nemar a835e50de5aa42a9 data.nemar.org, S3, raw (git-keyed sidecars)

Bit-identical data in all modes; with this PR the upstream host is never contacted.

  • pytest moabb/tests/test_download.py → 209 passed (5 new: provider semantics per mode, no-nemar_id skip, get_data prefetches exactly the requested subjects)
  • ruff check / ruff format clean
  • A broader 141-dataset upstream-vs-NEMAR equivalence sweep is running on Expanse against this branch; results will be posted here.

The store wired into loading by #1146 is only filled by an explicit
download() call, so a plain get_data() on a fresh machine still fetched
from the upstream host even with the provider pinned to 'nemar'. Fetch
the requested subjects' sourcedata/ before loading, with the provider
policy download() already implements: 'upstream' skips NEMAR, 'nemar'
treats a failure as fatal, 'auto' warns per subject and leaves that
subject to the dataset's own downloader. A non-empty store is trusted
as-is and costs no network, preserving the warmed-store guarantee the
end-to-end store test encodes.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

pooch.retrieve treats data_path's destination as a directory and stores
<md5(url)>-<basename> inside it; loaders such as Rodrigues2017's then
os.listdir() that directory. A store hit written as a plain file at the
destination shadowed the wrapper directory and turned those loads into
NotADirectoryError (Rodrigues2017, Cattan2019_PHMD, Cattan2019_VR in
the 141-dataset sweep). The hit now lands inside the wrapper directory
under pooch's unique name; verified live: Rodrigues2017 loads
bit-identically from the store with zero upstream contact.
@bruAristimunha
bruAristimunha merged commit d31fde2 into develop Aug 21, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant