Skip to content

Commit

Permalink
Merge branch 'main' into add-keyerror-openlineage
Browse files Browse the repository at this point in the history
  • Loading branch information
javihernovoa authored Sep 28, 2023
2 parents b62bb3e + 85f4f3b commit 9c5c645
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 22 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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)
------------------

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.1.1"
__version__ = "1.1.2"

from cosmos.airflow.dag import DbtDag
from cosmos.airflow.task_group import DbtTaskGroup
Expand Down
16 changes: 12 additions & 4 deletions cosmos/operators/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
32 changes: 16 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,34 +46,34 @@ dependencies = [

[project.optional-dependencies]
dbt-all = [
"dbt-bigquery<=1.5.4",
"dbt-databricks<=1.5.4",
"dbt-exasol<=1.5.4",
"dbt-postgres<=1.5.4",
"dbt-redshift<=1.5.4",
"dbt-snowflake<=1.5.4",
"dbt-spark<=1.5.4",
"dbt-bigquery",
"dbt-databricks",
"dbt-exasol",
"dbt-postgres",
"dbt-redshift",
"dbt-snowflake",
"dbt-spark",
]
dbt-bigquery = [
"dbt-bigquery<=1.5.4",
"dbt-bigquery",
]
dbt-databricks = [
"dbt-databricks<=1.5.4",
"dbt-databricks",
]
dbt-exasol = [
"dbt-exasol<=1.5.4",
"dbt-exasol",
]
dbt-postgres = [
"dbt-postgres<=1.5.4",
"dbt-postgres",
]
dbt-redshift = [
"dbt-redshift<=1.5.4",
"dbt-redshift",
]
dbt-snowflake = [
"dbt-snowflake<=1.5.4",
"dbt-snowflake",
]
dbt-spark = [
"dbt-spark<=1.5.4",
"dbt-spark",
]
openlineage = [
"openlineage-integration-common",
Expand Down Expand Up @@ -107,7 +107,7 @@ docker = [
"apache-airflow-providers-docker>=3.5.0",
]
kubernetes = [
"apache-airflow-providers-cncf-kubernetes>=5.1.1,<7.3.0",
"apache-airflow-providers-cncf-kubernetes>=5.1.1",
]


Expand All @@ -132,7 +132,7 @@ include = [
dependencies = [
"astronomer-cosmos[tests]",
"apache-airflow-providers-docker>=3.5.0",
"apache-airflow-providers-cncf-kubernetes>=5.1.1,<7.3.0",
"apache-airflow-providers-cncf-kubernetes>=5.1.1",
"types-PyYAML",
"types-attrs",
"types-requests",
Expand Down
4 changes: 3 additions & 1 deletion tests/operators/test_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def test_created_pod(test_hook):
"stdin": None,
"stdin_once": None,
"termination_message_path": None,
"termination_message_policy": None,
# "termination_message_policy": None,
"tty": None,
"volume_devices": None,
"volume_mounts": [],
Expand Down Expand Up @@ -213,6 +213,8 @@ def test_created_pod(test_hook):
},
"status": None,
}

computed_result = pod_obj.to_dict()
computed_result["spec"]["containers"][0].pop("termination_message_policy")
computed_result["metadata"].pop("namespace")
assert computed_result == expected_result

0 comments on commit 9c5c645

Please sign in to comment.