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

Fixing Providers cache #7357

Merged
merged 1 commit into from
Mar 28, 2023
Merged

Fixing Providers cache #7357

merged 1 commit into from
Mar 28, 2023

Conversation

bpoldrack
Copy link
Member

@bpoldrack bpoldrack commented Mar 27, 2023

I have no idea how it only now blew up, but the lazy loading of Providers.from_config_files is broken (probably since forever). That is, because it relies on get_dataset_root("") to detect whether the same config files would effectively be read. Not only does this ignore the fact that new/modified files could have appeared in the meantime, but more importantly, this is nonsense, because the stored root would always be "" whenever PWD is in a dataset's root. Meaning, if we switch into another dataset, the result is the same, hence no config is actually read.

Therefore, use the absolute path as the stored value to check against.

Closes #7347

@bpoldrack bpoldrack changed the title Fixing get_dataset_root Fixing Providers cache Mar 27, 2023
@bpoldrack bpoldrack added the semver-patch Increment the patch version when merged label Mar 27, 2023
Providers.from_config_files() stores the result of
`get_dataset_root("")` and delivers the previous resut, if not called
with `reload` and the dataset root is the same.
However, what effectively is stored when CWD is a dataset's root is the
empty string - so, effectively `.`. But this would be the same for any
dataset root we are in, therefore this lazy loading would not recognize,
that the dataset changed. This lead to side-effects of the order of test
execution, when a test provided new config files. Those files would be
ignored, when providers were read from within a different dataset
before.

Hence, use the absolute path to store and compare.

Closes datalad#7347
@bpoldrack bpoldrack marked this pull request as ready for review March 27, 2023 14:44
@codecov
Copy link

codecov bot commented Mar 27, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.20 ⚠️

Comparison is base (a8d7c63) 88.74% compared to head (2054255) 88.55%.

Additional details and impacted files
@@            Coverage Diff             @@
##            maint    #7357      +/-   ##
==========================================
- Coverage   88.74%   88.55%   -0.20%     
==========================================
  Files         327      327              
  Lines       44629    44630       +1     
  Branches     5913        0    -5913     
==========================================
- Hits        39605    39520      -85     
- Misses       5009     5110     +101     
+ Partials       15        0      -15     
Impacted Files Coverage Δ
datalad/utils.py 85.72% <ø> (-1.79%) ⬇️
datalad/downloaders/providers.py 95.33% <100.00%> (+0.01%) ⬆️

... and 23 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

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.

looks LGTM and passes tests for me locally

Thank you @bpoldrack for getting to the bottom of it!!!

@yarikoptic yarikoptic merged commit 0e89dd3 into datalad:maint Mar 28, 2023
@yarikoptic-gitmate
Copy link
Collaborator

PR released in 0.18.4

@yarikoptic yarikoptic deleted the fix-7347 branch February 2, 2024 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-patch Increment the patch version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test_datalad_credential_helper - AttributeError: 'NoneType' object has no attribute 'credential'
3 participants