-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Caching: Add
CACHE_VERSION
attribute to CalcJob
and Parser
Recently, the hashing mechanism was changed to remove all version information, both `aiida-core` and the plugin if applicable, from the hash computation. The reason was that with that information, each version change in core and plugin would essentially reset the cache. By removing the version information, updating the code would no longer invalidate all the cache. The downside of this change, however, is that when the implementation of a plugin, most notably `CalcJob` and `Parser` plugins, changes significantly such that a change in its attributes/inputs would really change its content, this would no longer be reflected in the hash, which would remain identical. This could lead to false positives when users update certain plugins. To give some control to plugin developers in case of changes where the hash would have to be effectively reset, the `CalcJob` and `Parser` classes now define the `CACHE_VERSION` class attribute. By default this is set to `None` but it can be set to an integer by a plugin developer. At this point, it is stored in the `cache_version` attribute under the `calc_job` or `parser` key, respectively. Since this attribute is included in the hash calculation, changing the value would effectively reset the cache for nodes generated with one of the plugins. The concept _could_ have been added to the `Node` base class to stay generic, however, this had complicates for `Data` nodes. Since the version data would have to be stored in the attributes, in order to prevent the risk from it being mutated or lost, it would interfere with the actual data of the node. For example, the `Dict` node is entirely defined by its attributes, so AiiDA cannot store any data in that namespace. Luckily, not having this cache version information in nodes other than `CalcJobNode`s is not a problematic, as the problem of inducing false positives by changing plugin code is really only relevant to `CalcJob` and `Parser` plugins.
- Loading branch information
Showing
6 changed files
with
116 additions
and
11 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