Skip to content
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

Add include_metadata=False parameter to asset-listing DandiAPIClient methods #378

Merged
merged 3 commits into from
Feb 10, 2021

Conversation

jwodder
Copy link
Member

@jwodder jwodder commented Feb 10, 2021

Closes #376.

@jwodder jwodder added the patch Increment the patch version when merged label Feb 10, 2021
@codecov
Copy link

codecov bot commented Feb 10, 2021

Codecov Report

Merging #378 (95a99a3) into master (d8aacc6) will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #378      +/-   ##
==========================================
+ Coverage   83.02%   83.14%   +0.11%     
==========================================
  Files          55       55              
  Lines        5609     5636      +27     
==========================================
+ Hits         4657     4686      +29     
+ Misses        952      950       -2     
Flag Coverage Δ
unittests 83.14% <100.00%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
dandi/dandiapi.py 87.55% <100.00%> (+0.76%) ⬆️
dandi/dandiarchive.py 78.87% <100.00%> (+0.30%) ⬆️
dandi/tests/test_dandiapi.py 100.00% <100.00%> (ø)
dandi/download.py 85.19% <0.00%> (+0.32%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d8aacc6...95a99a3. Read the comment docs.

For girder instances we do get metadata, and we get metadata for the dandiset.
So for consistency and better utility of "dandi ls" - always request metadata
for api server in navigate_url
to  not crash if for some reason API did not provide metadata for an asset.
We will rely on tests to ensure that API server provides, but otherwise - not crash
Copy link
Member

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pushed two tune ups (one is to address my own comment). If tests pass -- good to go (please merge) and if I broke something - would need to be fixed ;)

if include_metadata:
asset["metadata"] = self.get_asset(
dandiset_id, version, asset["uuid"]
)["metadata"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to be resilient and rely on tests to catch if behavior of the api server would change: please get_asset, and only if metadata is within the record - assign to the asset

@jwodder jwodder merged commit 351bd29 into master Feb 10, 2021
@jwodder jwodder deleted the gh-376 branch February 10, 2021 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DandiAPIClient.get_dandiset_*assets: add option include_metadata=False
2 participants