Skip to content

Commit

Permalink
implementing @effigies suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Feb 29, 2024
1 parent bb11067 commit a031ea5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pydra/utils/hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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):
Expand Down

0 comments on commit a031ea5

Please sign in to comment.