Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CalcJobNode
: Fix the computation of the hash (#5998)
The `CalcJobNode.get_hash()` was returning a different hash once the calculation had been completed, compared to the one stored in the `_aiida_hash` extra, which was computed when the node initially got stored. The reason is that upon storing, the repository of the `CalcJobNode` is empty, however, once the upload step has been completed, the input files generated by the `CalcJob` plugin will have been written to the repository, and so now its hash, and with it the hash of the entire node will be different. The solution is to exclude the repository hash from the objects that are used to compute the node's hash. This is acceptable, since the repository files are just a derivative of the input nodes, which are already captured in the hash. This solution was actually already in place and implemented by the `CalcJobNodeCaching`, however, it was never actually used. Since there was no test, this went by unnoticed since v2.0 at which point this code was introduced. The solution is simply just to set `CalcJobNode._CLS_NODE_CACHING` to the `CalcJobNodeCaching` subclass. A regression test is added to check that the `get_hash` method matches the `_aiida_hash` extra.
- Loading branch information