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

is_valid_cache settter is broken for ProcessNodes #5582

Closed
ltalirz opened this issue Jun 20, 2022 · 0 comments · Fixed by #5583
Closed

is_valid_cache settter is broken for ProcessNodes #5582

ltalirz opened this issue Jun 20, 2022 · 0 comments · Fixed by #5583
Assignees
Labels

Comments

@ltalirz
Copy link
Member

ltalirz commented Jun 20, 2022

Describe the bug

7cea5be introduced an is_valid_cache setter that, in theory, can be used to invalidate specific process node instances as far as the cache is concerned:

n=load_node(<PK>)
n.base.caching.is_valid_cache = False

Unfortunately, the setter does not actually work on any ProcessNode

In [5]: n.base.caching.is_valid_cache=False
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-e4b12fc7cfcc> in <cell line: 1>()
----> 1 n.base.caching.is_valid_cache=False

/ohome/shared/a-ctalirz/aiida2/aiida-core/aiida/orm/nodes/process/process.py in is_valid_cache(self, valid)
     66         :param valid: whether the node is valid or invalid for use in caching.
     67         """
---> 68         super().is_valid_cache = valid  # type: ignore[misc]
     69 
     70     def _get_objects_to_hash(self) -> List[Any]:

AttributeError: 'super' object has no attribute 'is_valid_cache'

The reason is a programming error related to the fact that in Python super() cannot be used to access setters directly (see e.g. this StackOverflow post and links therein).

I'll prepare a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant