Skip to content

Commit

Permalink
add additional existence checks
Browse files Browse the repository at this point in the history
  • Loading branch information
NodeJSmith committed Jan 10, 2025
1 parent ab1570e commit c521d02
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/otf_api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ def write_to_cache(self, data: dict[str, str]) -> None:
"""Writes the data to the cache file."""
LOGGER.debug(f"Writing {self.name} to cache ({self.cache_path})")

# double check everything exists
if not self.cache_path.parent.exists():
self.cache_path.parent.mkdir(parents=True, exist_ok=True)

if not self.cache_path.exists():
self.cache_path.touch()

existing_data = self.get_cached_data()
data = {**existing_data, **data}

Expand Down

0 comments on commit c521d02

Please sign in to comment.