-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This property allows to mark an individual node as invalid for use as a caching source. It works by setting the `_aiida_valid_cache` extra to either `True` or `False`. Previously, the unofficial way of ensuring a node was no longer used as a cache source, was to remove the `_aiida_hash` extra, containing the hash of the node. This would achieve the desired effect, since without a hash, the node would never be found when looking for identical nodes to cache from. However, this not an ideal approach because the hash may be useful for other purposes. In addition, if the node were to be rehashed at some point, which could happen by accident if all nodes of a particular class got rehashed, it would all of a sudden be used in caching again. The solution is to have a way to persistently mark node instances as invalid for caching. Note that the `is_valid_cache` property of the `Node` before was intended as a hook to allow changing the caching behavior of subclasses of `Node` as a whole, and not on the instance level. This is now changed as the property has a setter that operates on the instance level. Subclasses should take care to respect this base class implementation if it makes sense. Since `Node` can only be subclassed by `aiida-core` and not in plugins, we can easily enforce this system.
- Loading branch information
Showing
6 changed files
with
144 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters