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

Allow empty enabled and disabled keys in caching configuration #3330

Merged
merged 2 commits into from
Sep 19, 2019

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Sep 19, 2019

Fixes #3329

If the enabled or disabled key is specified in the caching
configuration but contains no values, or all values are commented, the
parsed dictionary will have None as the value for the corresponding
key. This was causing an exception inaiida.manage.caching._get_config
because it was always iterating over it without checking that it exactly
contained an iterable.

If the `enabled` or `disabled` key is specified in the caching
configuration but contains no values, or all values are commented, the
parsed dictionary will have `None` as the value for the corresponding
key. This was causing an exception in`aiida.manage.caching._get_config`
because it was always iterating over it without checking that it exactly
contained an iterable.
giovannipizzi
giovannipizzi previously approved these changes Sep 19, 2019
@sphuber sphuber changed the title Allow empty enabled and disabled keys in caching configuration [WIP] Allow empty enabled and disabled keys in caching configuration Sep 19, 2019
@sphuber
Copy link
Contributor Author

sphuber commented Sep 19, 2019

Don't merge yet. I just might have found another issue

If the keys are specified in the configuration file, but contain no
values, the parsed dictionary will have `None` as value. This will cause
exceptions in `get_use_cache` when it does the `in` check. To fix it we
replace the `None` with the default, an empty list.
@sphuber
Copy link
Contributor Author

sphuber commented Sep 19, 2019

Thanks @giovannipizzi for the approval but just found another issue. The last commit adds a test for it and solves it.

@sphuber sphuber changed the title [WIP] Allow empty enabled and disabled keys in caching configuration Allow empty enabled and disabled keys in caching configuration Sep 19, 2019
@sphuber sphuber merged commit d9bb312 into aiidateam:develop Sep 19, 2019
@sphuber sphuber deleted the fix_3329_caching_configuration branch September 19, 2019 16:18
d-tomerini pushed a commit to d-tomerini/aiida_core that referenced this pull request Sep 30, 2019
…iidateam#3330)

If the `enabled` or `disabled` key is specified in the caching
configuration but contains no values, or all values are commented, the
parsed dictionary will have `None` as the value for the corresponding
key. This was causing an exception in`aiida.manage.caching._get_config`
because it was always iterating over it without checking that it exactly
contained an iterable. Also `get_use_cache` was affected.
d-tomerini pushed a commit to d-tomerini/aiida_core that referenced this pull request Oct 16, 2019
…iidateam#3330)

If the `enabled` or `disabled` key is specified in the caching
configuration but contains no values, or all values are commented, the
parsed dictionary will have `None` as the value for the corresponding
key. This was causing an exception in`aiida.manage.caching._get_config`
because it was always iterating over it without checking that it exactly
contained an iterable. Also `get_use_cache` was affected.
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.

Node store method excepts for invalid caching configuration files
2 participants