Skip to content

Commit

Permalink
Attempt to understand issue when running DBT_LS in Cosmos 1.5 by cust…
Browse files Browse the repository at this point in the history
…omers
  • Loading branch information
tatiana committed Jul 16, 2024
1 parent e100b33 commit cc7c716
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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)
------------------

Expand Down
2 changes: 1 addition & 1 deletion cosmos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Contains dags, task groups, and operators.
"""
__version__ = "1.5.0"
__version__ = "1.5.1a1"


from cosmos.airflow.dag import DbtDag
Expand Down
3 changes: 3 additions & 0 deletions cosmos/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion cosmos/dbt/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit cc7c716

Please sign in to comment.