From 15258bf1988c1744114e34695ef47ba944b3c974 Mon Sep 17 00:00:00 2001 From: Tatiana Al-Chueyr Date: Thu, 28 Sep 2023 07:42:51 +0100 Subject: [PATCH] Release 1.1.2 (#562) This PR is a subset of the actual Release 1.1.2 (#560), since - for this release - we had to revert a [commit](https://github.com/astronomer/astronomer-cosmos/pull/560#issuecomment-1737659616) which we don't intend to revert on the project's main branch. Bug fixes * Fix using `ExecutionMode.KUBERNETES` by @pgoslatara and @tatiana in #554 * Add support to `apache-airflow-providers-cncf-kubernetes < 7.4.0` by @tatiana in #553 * Fix `on_warning_callback` behaviour on `DbtTestLocalOperator` by @edgga, @marco9663 and @tatiana in #558 * Use `returncode` instead of `stderr` to determine dbt graph loading errors by @cliff-lau-cloverhealth in #547 * Improve error message in `config.py` by @meyobagero in #532 * Fix `DbtTestOperator` when test does not have `test_metadata` by @tatiana in #558 * Fix `target-path` not specified issue in `dbt-project.yml` by @tatiana in #533 Others * Docs: add reference links to dbt and Airflow columns by @TJaniF in #542 * pre-commit updates #552 and #546 --- CHANGELOG.rst | 20 ++++++++++++++++++++ cosmos/__init__.py | 2 +- cosmos/operators/local.py | 16 ++++++++++++---- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b7aeef22a..bf0242465 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,26 @@ Changelog ========= +1.1.2 (2023-09-27) +------------------ + +Bug fixes + +* Fix using ``ExecutionMode.KUBERNETES`` by @pgoslatara and @tatiana in #554 +* Add support to ``apache-airflow-providers-cncf-kubernetes < 7.4.0`` by @tatiana in #553 +* Fix ``on_warning_callback`` behaviour on ``DbtTestLocalOperator`` by @edgga, @marco9663 and @tatiana in #558 +* Use ``returncode`` instead of ``stderr`` to determine dbt graph loading errors by @cliff-lau-cloverhealth in #547 +* Improve error message in ``config.py`` by @meyobagero in #532 +* Fix ``DbtTestOperator`` when test does not have ``test_metadata`` by @tatiana in #558 +* Fix ``target-path`` not specified issue in ``dbt-project.yml`` by @tatiana in #533 + +Others + +* Docs: add reference links to dbt and Airflow columns by @TJaniF in #542 +* pre-commit updates #552 and #546 + + + 1.1.1 (2023-09-14) ------------------ diff --git a/cosmos/__init__.py b/cosmos/__init__.py index fc58a7b99..b73414c8c 100644 --- a/cosmos/__init__.py +++ b/cosmos/__init__.py @@ -5,7 +5,7 @@ Contains dags, task groups, and operators. """ -__version__ = "1.1.1" +__version__ = "1.1.2" from cosmos.airflow.dag import DbtDag from cosmos.airflow.task_group import DbtTaskGroup diff --git a/cosmos/operators/local.py b/cosmos/operators/local.py index 52428753e..b6d0d12c8 100644 --- a/cosmos/operators/local.py +++ b/cosmos/operators/local.py @@ -42,8 +42,10 @@ ) from cosmos.dbt.parser.output import extract_log_issues, parse_output -logger = get_logger(__name__) +DBT_NO_TESTS_MSG = "Nothing to do" +DBT_WARN_MSG = "WARN" +logger = get_logger(__name__) try: from airflow.providers.openlineage.extractors.base import OperatorLineage @@ -473,12 +475,18 @@ def _handle_warnings(self, result: FullOutputSubprocessResult, context: Context) warning_context["test_names"] = test_names warning_context["test_results"] = test_results - if self.on_warning_callback: - self.on_warning_callback(warning_context) + self.on_warning_callback and self.on_warning_callback(warning_context) def execute(self, context: Context) -> None: result = self.build_and_run_cmd(context=context) - if self.on_warning_callback and "WARN" in result.output: + should_trigger_callback = all( + [ + self.on_warning_callback, + DBT_NO_TESTS_MSG not in result.output, + DBT_WARN_MSG in result.output, + ] + ) + if should_trigger_callback: warnings = parse_output(result, "WARN") if warnings > 0: self._handle_warnings(result, context)