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

do not fail if metadata cannot be updated for an image #2167

Conversation

jeromedockes
Copy link
Member

In some cases the neurovault fetcher tries to update the metadata. at the moment this can fail if the user has write permission for the neurovault data directory, but not for the metadata file of a particular image for some weird reason. this pr skips these updates with a warning

@kchawla-pi
Copy link
Collaborator

Add your opening comment into the error message. The current one does not explain what's really going on.

_write_metadata(image_info, metadata_file_path)
except OSError:
warnings.warn("could not update metadata for image {}".format(
image_info["id"]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be better to only include the error generating step in the try block.

Copy link
Member Author

Choose a reason for hiding this comment

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

all statements except the third can fail because of write permissions

@codecov
Copy link

codecov bot commented Oct 13, 2019

Codecov Report

Merging #2167 into master will decrease coverage by <.01%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2167      +/-   ##
=========================================
- Coverage   92.31%   92.3%   -0.01%     
=========================================
  Files         149     149              
  Lines       18786   18789       +3     
  Branches     2291    2291              
=========================================
+ Hits        17342   17343       +1     
- Misses        922     924       +2     
  Partials      522     522
Impacted Files Coverage Δ
nilearn/datasets/neurovault.py 88.43% <71.42%> (-0.25%) ⬇️

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 d566678...1a7682d. Read the comment docs.

@kchawla-pi kchawla-pi merged commit 3f2d828 into nilearn:master Oct 14, 2019
kchawla-pi added a commit to kchawla-pi/nilearn that referenced this pull request Oct 14, 2019
* 'master' of github.com:nilearn/nilearn:
  Fix cache mixin tests (nilearn#2161)
  Do not fail if metadata cannot be updated for an image (nilearn#2167)
  [MRG] Nans in view connectome (nilearn#2166)
kchawla-pi added a commit to kchawla-pi/nilearn that referenced this pull request Oct 14, 2019
kchawla-pi added a commit to illdopejake/nilearn that referenced this pull request Oct 14, 2019
…nt_modify_fetch_dev

* 'master' of https://github.com/nilearn/nilearn:
  ENH: add connectome strength plot (nilearn#2028)
  Fix cache mixin tests (nilearn#2161)
  Do not fail if metadata cannot be updated for an image (nilearn#2167)
kchawla-pi added a commit to KamalakerDadi/nilearn that referenced this pull request Oct 14, 2019
…ecomposition

* 'master' of https://github.com/nilearn/nilearn:
  Fix Flake8 errors overlooked when merging PR nilearn#2028 (Plot connectome strength) (nilearn#2174)
  ENH: add connectome strength plot (nilearn#2028)
  Fix cache mixin tests (nilearn#2161)
  Do not fail if metadata cannot be updated for an image (nilearn#2167)
  [MRG] Nans in view connectome (nilearn#2166)
kchawla-pi added a commit to pausz/nilearn that referenced this pull request Oct 18, 2019
…smooth-image

* 'master' of https://github.com/nilearn/nilearn: (114 commits)
  [DOC] Update whats_new to reference nilearn#2013 (Merging of several examples) (nilearn#2183)
  Removed sub-example due to unfit for lasso dataset - unstable float values (nilearn#2177)
  Fix Flake8 errors overlooked when merging PR nilearn#2028 (Plot connectome strength) (nilearn#2174)
  ENH: add connectome strength plot (nilearn#2028)
  Fix cache mixin tests (nilearn#2161)
  Do not fail if metadata cannot be updated for an image (nilearn#2167)
  [MRG] Nans in view connectome (nilearn#2166)
  [MRG] FIX: orientation problem with plot_glass_brain (nilearn#1888)
  Import HTMLDocument in its original module to preserve backwards compatibility (nilearn#2162)
  Fixing malfunctioning allowed-failure section in Travis (nilearn#2160)
  Update Brainomics fetcher (nilearn#2097)
  Remove inplace modification in signal.clean (nilearn#2125)
  Iter age group prediction example (nilearn#2063)
  Expose bg_img, vmin and vmax in plot_img signature (nilearn#2157)
  Replac conda with pip in TravisCI setup (nilearn#2141)
  Core devs doc and add @emdupre (nilearn#2151)
  Add check for vmin, vmax in plot_surf_roi (nilearn#2052)
  [ENH] Initial visual reports (nilearn#2019)
  Renamed test to deduplicate name (nilearn#2144)
  Fixes nilearn#2029 Handle gzip files without extensions (nilearn#2126)
  ...
kchawla-pi added a commit that referenced this pull request Oct 21, 2019
* Updated .mailmap

* Updated contributors list

* Removed unsupported python versions from PyPI tags

* Added whats_new entry for PR #2167

* Updated Whats whats_new list of contributors
kchawla-pi added a commit to kchawla-pi/nilearn that referenced this pull request Oct 24, 2019
…te-req-dev

* 'master' of https://github.com/nilearn/nilearn: (336 commits)
  Release Nilearn 0.6.0 alpha (nilearn#2164)
  Making fetch_localizer_button_task backwards compatibile (nilearn#2182)
  [DOC] Update whats_new to reference nilearn#2013 (Merging of several examples) (nilearn#2183)
  Removed sub-example due to unfit for lasso dataset - unstable float values (nilearn#2177)
  Fix Flake8 errors overlooked when merging PR nilearn#2028 (Plot connectome strength) (nilearn#2174)
  ENH: add connectome strength plot (nilearn#2028)
  Fix cache mixin tests (nilearn#2161)
  Do not fail if metadata cannot be updated for an image (nilearn#2167)
  [MRG] Nans in view connectome (nilearn#2166)
  [MRG] FIX: orientation problem with plot_glass_brain (nilearn#1888)
  Import HTMLDocument in its original module to preserve backwards compatibility (nilearn#2162)
  Fixing malfunctioning allowed-failure section in Travis (nilearn#2160)
  Update Brainomics fetcher (nilearn#2097)
  Remove inplace modification in signal.clean (nilearn#2125)
  Iter age group prediction example (nilearn#2063)
  Expose bg_img, vmin and vmax in plot_img signature (nilearn#2157)
  Replac conda with pip in TravisCI setup (nilearn#2141)
  Core devs doc and add @emdupre (nilearn#2151)
  Add check for vmin, vmax in plot_surf_roi (nilearn#2052)
  [ENH] Initial visual reports (nilearn#2019)
  ...
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.

None yet

3 participants