-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dandi export and read #956
base: master
Are you sure you want to change the base?
Conversation
I know this is still a WIP, but we should also decide whether to make dandi a dependency or an optional dependency. |
src/spyglass/common/common_dandi.py
Outdated
definition = """ | ||
-> Export.File | ||
--- | ||
dandiset_id: str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the dandiset_id
the same for all files in a given Export
? If so, I might avoid some redundancy by having DandiPath
be a master table with one part per Export.File
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As written, the dandiset ID is common for everything in export. However I could see a future case where an analysis file is used in multiple papers and rather than re-uploading a new copy of the file to dandi you would point to it's existing version in a different dandiset. I might lean towards leaving the flexibility for this in the table structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does dandi handle this case? Presumably, they wouldn't want to store two copies of the same data file across dandisets. But, if the name is contextually determined by other files, the name would have to differ. I wouldn't be surprised if they had cross-dandiset soft-link tool, but I don't know for sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would have different names on Dandi, but they would share the same object_id for the file. I haven't tested if that blocks upload.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just took a quick first pass to keep up to speed
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
I'm leaving the functions pointing to the Dandi dev server for now until the other parts of the code are reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work, @samuelbray32. I had some comments, but I think the heaviest lifting would be migrating it all to common_dandi
to revise the dependency order. I'm happy to help migrating to a more object-oriented approach so the helpers can share properties
# > | ||
# >To aid in correcting common formatting errors identified with changes in dandi standards, we have included the method | ||
# ``` | ||
# Export()._prepare_files_for_export(paper_key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's a func we think users will adopt, I'd remove the _
prefix that implies 'this is just for other funcs to call'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was using this to try to indicate it's function that shouldn't be used frequently since it requires admin permissions. Open to other ideas of how to indicate this or can remove
src/spyglass/common/common_usage.py
Outdated
# make a temp dir with symbolic links to the export files | ||
source_files = (self.File() & key).fetch("file_path") | ||
paper_dir = f"{export_dir}/{paper_id}" | ||
os.makedirs(paper_dir, exist_ok=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If replacing os
with pathlib
, you can pathlib_dir.mkdir(parents=True, exist_ok=True)
src/spyglass/common/common_usage.py
Outdated
translations = [ | ||
{ | ||
**( | ||
self.File() & key & f"file_path LIKE '%{t['filename']}'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My file_like
helper would work here i think
Thanks @CBroz1. I can work on moving the functionality into dandi_common. For another common comment, |
FYI |
Description
Partial steps for #861
Step (3)
DandiPath
Export.compile_dandiset()
DandiPath
Export._prepare_files_for_export()
Step (4)
fetch_nwb
which streams file from dandi if availableChecklist:
CITATION.cff
alter
snippet for release notes.CHANGELOG.md
with PR number and description.