Skip to content

Commit

Permalink
create path to cache file if it does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
saikonen committed Aug 20, 2024
1 parent bcab087 commit d47efe7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions metaflow/plugins/fast_bakery/docker_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def wrapper(*args, **kwargs):
f.truncate()
json.dump(cache, f)
except FileNotFoundError:
# path to cachefile might not exist.
os.makedirs(os.path.dirname(cache_file), exist_ok=True)
with open(cache_file, "w") as f:
fcntl.flock(f.fileno(), fcntl.LOCK_EX)
json.dump({cache_key: result.response}, f)
Expand Down

0 comments on commit d47efe7

Please sign in to comment.