From e0d45f362f31bc416dcf43cb27201687e4f4b90a Mon Sep 17 00:00:00 2001 From: Tatiana Al-Chueyr Date: Wed, 17 Jul 2024 00:54:58 +0100 Subject: [PATCH] Ignore invalid filepaths to create the dbt dir cache key --- CHANGELOG.rst | 2 +- cosmos/__init__.py | 2 +- cosmos/cache.py | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 146c7b2f2..f7895fdaa 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,7 @@ Changelog ========= -1.5.1a2 (2024-07-17) +1.5.1a3 (2024-07-17) -------------------- Bug fixes diff --git a/cosmos/__init__.py b/cosmos/__init__.py index 611b99b5b..249eaf006 100644 --- a/cosmos/__init__.py +++ b/cosmos/__init__.py @@ -5,7 +5,7 @@ Contains dags, task groups, and operators. """ -__version__ = "1.5.1a2" +__version__ = "1.5.1a3" from cosmos.airflow.dag import DbtDag from cosmos.airflow.task_group import DbtTaskGroup diff --git a/cosmos/cache.py b/cosmos/cache.py index 1e83e739b..eacef8727 100644 --- a/cosmos/cache.py +++ b/cosmos/cache.py @@ -230,9 +230,12 @@ def _create_folder_version_hash(dir_path: Path) -> str: filepaths.extend(paths) for filepath in sorted(filepaths): - with open(str(filepath), "rb") as fp: - buf = fp.read() - hasher.update(buf) + try: + with open(str(filepath), "rb") as fp: + buf = fp.read() + hasher.update(buf) + except FileNotFoundError: + logger.debug(f"Skipping invalid path {filepath}") return hasher.hexdigest()