From cc7c716e51594532eb8588d857e31824cf6d6b4c Mon Sep 17 00:00:00 2001 From: Tatiana Al-Chueyr Date: Tue, 16 Jul 2024 23:18:35 +0100 Subject: [PATCH] Attempt to understand issue when running DBT_LS in Cosmos 1.5 by customers --- CHANGELOG.rst | 8 ++++++++ cosmos/__init__.py | 2 +- cosmos/cache.py | 3 +++ cosmos/dbt/graph.py | 7 ++++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 66e9af5ea..1f18c0f52 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,14 @@ Changelog ========= +1.5.0a1 (2024-07-16) +-------------------- + +Bug fixes + +* (WIP) Fix project_path when using DBT_LS mode by @tatiana + + 1.5.0 (2024-06-27) ------------------ diff --git a/cosmos/__init__.py b/cosmos/__init__.py index cfaa5def3..85d56ff7f 100644 --- a/cosmos/__init__.py +++ b/cosmos/__init__.py @@ -5,7 +5,7 @@ Contains dags, task groups, and operators. """ -__version__ = "1.5.0" +__version__ = "1.5.1a1" from cosmos.airflow.dag import DbtDag diff --git a/cosmos/cache.py b/cosmos/cache.py index d519eaca4..e8c4db894 100644 --- a/cosmos/cache.py +++ b/cosmos/cache.py @@ -246,6 +246,9 @@ def _calculate_dbt_ls_cache_current_version(cache_identifier: str, project_dir: :param project_path: Path to the target dbt project directory :param cmd_args: List containing the arguments passed to the dbt ls command that would affect its output """ + logger.info( + f"_calculate_dbt_ls_cache_current_version for {cache_identifier} received the project_dir: {project_dir}" + ) start_time = time.perf_counter() # Combined value for when the dbt project directory files were last modified diff --git a/cosmos/dbt/graph.py b/cosmos/dbt/graph.py index 62b6d88bf..22a30e1ab 100644 --- a/cosmos/dbt/graph.py +++ b/cosmos/dbt/graph.py @@ -195,6 +195,9 @@ def project_path(self) -> Path: """ # we're considering the execution_config only due to backwards compatibility path = self.render_config.project_path or self.project.dbt_project_path or self.execution_config.project_path + logger.info( + f"Identifying the project path for {self.dbt_ls_cache_key}: path: {path}, path absolute: {path and path.absolute()}, render_config: {self.render_config.project_path}, project: {self.project.dbt_project_path}, execution_config: {self.execution_config.project_path}" + ) if not path: raise CosmosLoadDbtException( "Unable to load project via dbt ls without RenderConfig.dbt_project_path, ProjectConfig.dbt_project_path or ExecutionConfig.dbt_project_path" @@ -261,7 +264,9 @@ def save_dbt_ls_cache(self, dbt_ls_output: str) -> None: dbt_ls_compressed = encoded_data.decode("utf-8") cache_dict = { "version": cache._calculate_dbt_ls_cache_current_version( - self.dbt_ls_cache_key, self.project_path, self.dbt_ls_cache_key_args + cache_identifier=self.dbt_ls_cache_key, + project_dir=self.project_path, + cmd_args=self.dbt_ls_cache_key_args, ), "dbt_ls_compressed": dbt_ls_compressed, "last_modified": datetime.datetime.now(datetime.timezone.utc).isoformat(),