-
Notifications
You must be signed in to change notification settings - Fork 84
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
Test ROS3 streaming in CI and add ROS3 tutorial #1393
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #1393 +/- ##
=======================================
Coverage 76.78% 76.78%
=======================================
Files 37 37
Lines 2731 2731
Branches 455 455
=======================================
Hits 2097 2097
Misses 552 552
Partials 82 82 Continue to review full report at Codecov.
|
I added a ROS3 streaming test to the CI. The test pulls a small file from DANDI. Please review the test to make sure it makes sense. I hope this doesn't put too much of a burden on DANDI. The CI runs on CircleCI (linux) on every push and nightly, and it runs on Azure (Windows, MacOS) nightly. |
tests/integration/ros3/test_ros3.py
Outdated
filepath = 'sub-anm372795/sub-anm372795_ses-20170718.nwb' | ||
s3_path = get_dandi_s3_url(dandiset_id, filepath) |
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.
Rather than using an actual user asset, I think it would make sense for DANDI to have an S3 bucket with small test files. This is both to make this easier to control but also because running tests against actual data will throw off usage stats for DANDI.
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.
Having an S3 test bucket on DANDI would also allow testing against NWB files with different versions (as part of a nightly test).
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.
The test now points to https://dandiarchive.s3.amazonaws.com/ros3test.nwb
assuming that @yarikoptic or someone else on the DANDI team can host that.
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.
Assuming this is an easy thing for the DANDI team to do, I'd like to hold the release until tomorrow so that we can get this PR in. @oruebel would that be all right?
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.
which file we should host? I would prefer if you provide one so it is not encumbered by any possible fiasco with user wishes/license/suboptimal nwb version etc. Just create one (or some) you would like to see representative of the features you would gain with ROS3 (not fetching "large" data arrays etc) and share and we will gladly host it/them
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.
@rly - nothing is stable till you publish. but once published then you should expect some stability.
regarding redirect, i'm 90% sure the hdf5 library doesn't support a redirect.
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.
That's a good point. Now that we have published datasets, maybe we should use one of those.
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.
filed HDFGroup/hdf5#905
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.
After a dataset is published, can I still add files to it, or is it locked forever?
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.
you can think of it as software releases. you can add, but the published version contains only the assets it was published with.
Thanks! Looks good. I created a thumbnail for the tutorial. |
# with NWBHDF5IO(s3_path, mode='r', load_namespaces=True, driver='ros3') as io: | ||
# nwbfile = io.read() |
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 there a reason for using a context-manager here on read. I'm just wondering since we normally tend to use contexts only on write.
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.
That is a good question. I had always followed the rule of thumb to use a context manager when opening a file to be safe. It should not make a difference in virtually all cases - the file will be closed on garbage collection and having the file open doesn't stop other processes from reading or modifying the file. However, if someone is using Windows and going to delete the file before garbage collection (or thinks another process might delete it), then the file must be explicitly closed before it can be deleted. So I think to be safe, it is ever so slightly better to use a context manager.
import h5py
import os
filename = 'nwbfile.nwb'
f = h5py.File(filename, 'r')
os.remove(filename) # fails on windows
See also:
https://stackoverflow.com/questions/56149237/do-i-need-to-manually-close-a-hdf5-file
https://stackoverflow.com/questions/7395542/is-explicitly-closing-files-important/7395906#7395906
* rmv s3 utils * rmv corresponding tests * update tutorial to use latest dandi tools instead
@rly you used functions that I wrote a while back before these features were exposed in the dandi python package. Now that those tools are available, it is much simpler to use them. I pushed the change. What do you think? |
@bendichter This looks good, thanks! |
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.
Looks good. Just for record-keeping, can we add a note in the release notes that there is now a DANDI asset for nightly tests with a link. Not that this is technically a feature of PyNWB but it would be nice to have a record of it.
Updated now |
Motivation
Resolve #1392.
How to test the behavior?
Checklist
flake8
from the source directory.