From a031ea5dfc1571d2171e0df4157bb97114b9b1eb Mon Sep 17 00:00:00 2001 From: Tom Close Date: Thu, 29 Feb 2024 19:11:06 +1100 Subject: [PATCH] implementing @effigies suggestions --- pydra/utils/hash.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pydra/utils/hash.py b/pydra/utils/hash.py index f0eae477a0..7d09f8255c 100644 --- a/pydra/utils/hash.py +++ b/pydra/utils/hash.py @@ -129,7 +129,8 @@ def get_or_calculate_hash(self, key: CacheKey, calculate_hash: ty.Callable) -> H Returns ------- Hash - _description_ + the hash corresponding to the key, which is either retrieved from the persistent + store or calculated using `calculate_hash` if not present """ try: return self._hashes[key] @@ -141,6 +142,7 @@ def get_or_calculate_hash(self, key: CacheKey, calculate_hash: ty.Callable) -> H return Hash(key_path.read_bytes()) hsh = calculate_hash() key_path.write_bytes(hsh) + self._hashes[key] = Hash(hsh) return Hash(hsh) def clean_up(self):