Skip to content

feat(session): download data files that are stored online - #148

Draft
ehennestad wants to merge 1 commit into
dsm-converter-ebrains-follow-upsfrom
session-remote-file-download
Draft

ehennestad wants to merge 1 commit into
dsm-converter-ebrains-follow-upsfrom
session-remote-file-download

Conversation

@ehennestad

@ehennestad ehennestad commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

Mechanism

Session.loadData resolves a variable's file and reads it with the variable's file adapter. A data location can hold empty placeholder files for a dataset that is stored online, such as a cloned EBRAINS bucket.

Problem

Loading a placeholder failed with "file is empty (0 bytes)", and NANSEN had no way to fetch the file.

Changes

  • Add the abstract class nansen.dataio.RemoteFileSource with isOnlineOnly(filePath) and download(filePath). A project names its subclass with Project.setRemoteFileSource(className), which checks that the class inherits from RemoteFileSource.
  • loadData asks the source before the empty-file check. With Project.setAutoDownloadRemoteFiles(true) it downloads the file; otherwise it raises NANSEN:Session:FileIsOnlineOnly, which names Session.downloadDataFile. A project without a source, and a session object used where no user session is active (for example in a parallel worker), load files as before.
  • Session.downloadDataFile(varName) downloads the file of one variable.
  • Tests: RemoteFileDownloadTest with RemoteFileSourceFake, and LoadDataWithoutUserSessionTest.

🤖 Generated with Claude Code

A data location can hold placeholders for files that are stored
online, such as the empty files of a cloned EBRAINS bucket. A project
now names a subclass of nansen.dataio.RemoteFileSource with
Project.setRemoteFileSource. The source tells which files are
placeholders and downloads them.

Session.loadData checks each file before loading it. When the file is
a placeholder, it downloads the file if the project preference
AutoDownloadRemoteFiles is true (Project.setAutoDownloadRemoteFiles),
and otherwise raises NANSEN:Session:FileIsOnlineOnly, which names
Session.downloadDataFile. Session.downloadDataFile downloads the file
of one variable. A project without a source, and a session object
used where no user session is active, such as in a parallel worker,
load files as before.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ehennestad
ehennestad added this pull request to stack #122 September 19, 2026 16:41
@ehennestad ehennestad changed the title session remote file download feat(session): download data files that are stored online Sep 19, 2026
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