Skip to content

Commit

Permalink
Make sure caching does not fail
Browse files Browse the repository at this point in the history
  • Loading branch information
b8raoult committed Jul 13, 2023
1 parent b8c0dee commit 848cc00
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions climetlab/core/caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,16 +683,20 @@ def cache_file(
),
)

record = register_cache_file(path, owner, args)
if os.path.exists(path):
if callable(force):
owner_data = record["owner_data"]
if owner_data is not None:
owner_data = json.loads(owner_data)
force = force(args, path, owner_data)

if force:
decache_file(path)
try:

record = register_cache_file(path, owner, args)
if os.path.exists(path):
if callable(force):
owner_data = record["owner_data"]
if owner_data is not None:
owner_data = json.loads(owner_data)
force = force(args, path, owner_data)

if force:
decache_file(path)
except Exception as e:
LOG.warning("Cannot register cache file %s: %s", path, e)

if not os.path.exists(path):
lock = path + ".lock"
Expand Down

0 comments on commit 848cc00

Please sign in to comment.