Skip to content

Commit 6487f85

Browse files
authored
Merge branch 'main' into release-1.12
2 parents 2f5fff0 + ea2cfea commit 6487f85

70 files changed

Lines changed: 541 additions & 366 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "daily"
7+
cooldown:
8+
default-days: 7
79
labels:
810
- "dependencies"
911
reviewers:

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343

4444
steps:
4545
- name: Checkout repository
46-
uses: actions/checkout@v6.0.0
46+
uses: actions/checkout@v6.0.1
4747
with:
4848
persist-credentials: false
4949

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
contents: read
1313

1414
steps:
15-
- uses: actions/checkout@v6.0.0
15+
- uses: actions/checkout@v6.0.1
1616
with:
1717
persist-credentials: false
1818

.github/workflows/test.yml

Lines changed: 54 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
permissions:
3434
contents: read
3535
steps:
36-
- uses: actions/checkout@v6.0.0
36+
- uses: actions/checkout@v6.0.1
3737
with:
3838
ref: ${{ github.event.pull_request.head.sha || github.ref }}
3939
persist-credentials: false
@@ -54,30 +54,37 @@ jobs:
5454
strategy:
5555
fail-fast: false
5656
matrix:
57-
python-version: ["3.10", "3.11", "3.12"]
58-
airflow-version: ["2.4", "2.5", "2.6", "2.7", "2.8", "2.9", "2.10", "2.11", "3.0", "3.1"]
57+
python-version: ["3.10", "3.11", "3.12", "3.13"]
58+
airflow-version: ["2.6", "2.7", "2.8", "2.9", "2.10", "2.11", "3.0", "3.1"]
5959
dbt-version: ["1.10"]
6060
exclude:
61-
- python-version: "3.11"
62-
airflow-version: "2.4"
63-
- python-version: "3.11"
64-
airflow-version: "2.5"
6561
# Apache Airflow versions prior to 2.9.0 have not been tested with Python 3.12.
6662
# Official support for Python 3.12 and the corresponding constraints.txt are available only for Apache Airflow >= 2.9.0.
6763
# See: https://github.com/apache/airflow/tree/2.9.0?tab=readme-ov-file#requirements
6864
# See: https://github.com/apache/airflow/tree/2.8.4?tab=readme-ov-file#requirements
69-
- python-version: "3.12"
70-
airflow-version: "2.4"
71-
- python-version: "3.12"
72-
airflow-version: "2.5"
7365
- python-version: "3.12"
7466
airflow-version: "2.6"
7567
- python-version: "3.12"
7668
airflow-version: "2.7"
7769
- python-version: "3.12"
7870
airflow-version: "2.8"
71+
# Apache Airflow versions prior to 3.1.0 have not been tested with Python 3.13.
72+
- python-version: "3.13"
73+
airflow-version: "2.6"
74+
- python-version: "3.13"
75+
airflow-version: "2.7"
76+
- python-version: "3.13"
77+
airflow-version: "2.8"
78+
- python-version: "3.13"
79+
airflow-version: "2.9"
80+
- python-version: "3.13"
81+
airflow-version: "2.10"
82+
- python-version: "3.13"
83+
airflow-version: "2.11"
84+
- python-version: "3.13"
85+
airflow-version: "3.0"
7986
steps:
80-
- uses: actions/checkout@v6.0.0
87+
- uses: actions/checkout@v6.0.1
8188
with:
8289
ref: ${{ github.event.pull_request.head.sha || github.ref }}
8390
persist-credentials: false
@@ -119,14 +126,35 @@ jobs:
119126
strategy:
120127
fail-fast: false
121128
matrix:
122-
python-version: ["3.10", "3.11"]
123-
airflow-version: ["2.4", "2.5", "2.6", "2.7", "2.8", "2.9", "2.10", "2.11", "3.0", "3.1"]
129+
python-version: ["3.10", "3.11", "3.12", "3.13"]
130+
airflow-version: ["2.6", "2.7", "2.8", "2.9", "2.10", "2.11", "3.0", "3.1"]
124131
dbt-version: ["1.10"]
125132
exclude:
126-
- python-version: "3.11"
127-
airflow-version: "2.4"
128-
- python-version: "3.11"
129-
airflow-version: "2.5"
133+
# Apache Airflow versions prior to 2.9.0 have not been tested with Python 3.12.
134+
# Official support for Python 3.12 and the corresponding constraints.txt are available only for Apache Airflow >= 2.9.0.
135+
# See: https://github.com/apache/airflow/tree/2.9.0?tab=readme-ov-file#requirements
136+
# See: https://github.com/apache/airflow/tree/2.8.4?tab=readme-ov-file#requirements
137+
- python-version: "3.12"
138+
airflow-version: "2.6"
139+
- python-version: "3.12"
140+
airflow-version: "2.7"
141+
- python-version: "3.12"
142+
airflow-version: "2.8"
143+
# Apache Airflow versions prior to 3.1.0 have not been tested with Python 3.13.
144+
- python-version: "3.13"
145+
airflow-version: "2.6"
146+
- python-version: "3.13"
147+
airflow-version: "2.7"
148+
- python-version: "3.13"
149+
airflow-version: "2.8"
150+
- python-version: "3.13"
151+
airflow-version: "2.9"
152+
- python-version: "3.13"
153+
airflow-version: "2.10"
154+
- python-version: "3.13"
155+
airflow-version: "2.11"
156+
- python-version: "3.13"
157+
airflow-version: "3.0"
130158
services:
131159
postgres:
132160
image: postgres@sha256:4cd697181d4bd3ddc41a09012f339fa8cb5a8cd3d8b30130ea8378c176b6c494 # 14.18
@@ -140,7 +168,7 @@ jobs:
140168
ports:
141169
- 5432:5432
142170
steps:
143-
- uses: actions/checkout@v6.0.0
171+
- uses: actions/checkout@v6.0.1
144172
with:
145173
ref: ${{ github.event.pull_request.head.sha || github.ref }}
146174
persist-credentials: false
@@ -223,7 +251,7 @@ jobs:
223251
- 5432:5432
224252

225253
steps:
226-
- uses: actions/checkout@v6.0.0
254+
- uses: actions/checkout@v6.0.1
227255
with:
228256
ref: ${{ github.event.pull_request.head.sha || github.ref }}
229257
persist-credentials: false
@@ -309,7 +337,7 @@ jobs:
309337
- 5432:5432
310338

311339
steps:
312-
- uses: actions/checkout@v6.0.0
340+
- uses: actions/checkout@v6.0.1
313341
with:
314342
ref: ${{ github.event.pull_request.head.sha || github.ref }}
315343
persist-credentials: false
@@ -385,7 +413,7 @@ jobs:
385413
- 5432:5432
386414

387415
steps:
388-
- uses: actions/checkout@v6.0.0
416+
- uses: actions/checkout@v6.0.1
389417
with:
390418
ref: ${{ github.event.pull_request.head.sha || github.ref }}
391419
persist-credentials: false
@@ -455,7 +483,7 @@ jobs:
455483
dbt-version: ["2.0"] # dbt Fusion
456484

457485
steps:
458-
- uses: actions/checkout@v6.0.0
486+
- uses: actions/checkout@v6.0.1
459487
with:
460488
ref: ${{ github.event.pull_request.head.sha || github.ref }}
461489
persist-credentials: false
@@ -552,7 +580,7 @@ jobs:
552580
ports:
553581
- 5432:5432
554582
steps:
555-
- uses: actions/checkout@v6.0.0
583+
- uses: actions/checkout@v6.0.1
556584
with:
557585
ref: ${{ github.event.pull_request.head.sha || github.ref }}
558586
persist-credentials: false
@@ -614,7 +642,7 @@ jobs:
614642
airflow-version: [ "2.10", "3.0" ]
615643
dbt-version: [ "1.10" ]
616644
steps:
617-
- uses: actions/checkout@v6.0.0
645+
- uses: actions/checkout@v6.0.1
618646
with:
619647
ref: ${{ github.event.pull_request.head.sha || github.ref }}
620648
persist-credentials: false
@@ -685,7 +713,7 @@ jobs:
685713
permissions:
686714
contents: read
687715
steps:
688-
- uses: actions/checkout@v6.0.0
716+
- uses: actions/checkout@v6.0.1
689717
with:
690718
ref: ${{ github.event.pull_request.head.sha || github.ref }}
691719
persist-credentials: false

.github/workflows/zizmor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
security-events: write
1717
steps:
1818
- name: Checkout repository
19-
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
19+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2020
with:
2121
persist-credentials: false
2222

2323
- name: Run zizmor 🌈
24-
uses: zizmorcore/zizmor-action@e673c3917a1aef3c65c972347ed84ccd013ecda4 # v0.2.0
24+
uses: zizmorcore/zizmor-action@e639db99335bc9038abc0e066dfcd72e23d26fb4 # v0.3.0

.pre-commit-config.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
3+
default_language_version:
4+
python: python3.10
5+
36
repos:
47
- repo: local
58
hooks:
@@ -50,20 +53,20 @@ repos:
5053
- id: remove-tabs
5154
exclude: ^docs/make.bat$|^docs/Makefile$|^dev/dags/dbt/jaffle_shop/seeds/raw_orders.csv$
5255
- repo: https://github.com/asottile/pyupgrade
53-
rev: v3.21.1
56+
rev: v3.21.2
5457
hooks:
5558
- id: pyupgrade
5659
args:
57-
- --py37-plus
60+
- --py310-plus
5861
- --keep-runtime-typing
5962
- repo: https://github.com/astral-sh/ruff-pre-commit
60-
rev: v0.14.5
63+
rev: v0.14.8
6164
hooks:
6265
- id: ruff
6366
args:
6467
- --fix
6568
- repo: https://github.com/psf/black-pre-commit-mirror
66-
rev: 25.11.0
69+
rev: 25.12.0
6770
hooks:
6871
- id: black
6972
args: ["--config", "./pyproject.toml"]
@@ -74,7 +77,7 @@ repos:
7477
alias: black
7578
additional_dependencies: [black>=22.10.0]
7679
- repo: https://github.com/pre-commit/mirrors-mypy
77-
rev: "v1.18.2"
80+
rev: "v1.19.0"
7881

7982
hooks:
8083
- id: mypy

CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,19 @@ Others
7777
* Bump ``actions/checkout`` from ``6.0.0`` to ``6.0.1`` by @dependabot in #2178
7878
* pre-commit autoupdate by @pre-commit-ci[bot] in #2134, #2162, #2173, #2191
7979

80+
1.11.2 (2025-11-24)
81+
--------------------
82+
83+
Bug fixes
84+
85+
* Force ``DbtProducerWatcherOperator`` retries to zero by @pankajkoti in #2114
86+
* Fail ``DbtConsumerWatcherSensor`` tasks immediately when the ``DbtProducerWatcherOperator`` fails using Airflow context by @pankajkoti in #2126
87+
* Fix forwarding ``DbtProducerWatcherOperator`` ``dbt build`` flags by @michal-mrazek in #2127
88+
89+
Documentation
90+
91+
* Expand ``ExecutionMode.KUBERNETES`` guidance by @tatiana in #2139
92+
* Document dataset-event limitation when using ``ExecutionMode.AIRFLOW_ASYNC`` by @varaprasadregani in #2143
8093

8194
1.11.1 (2025-11-12)
8295
--------------------

cosmos/_triggers/watcher.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44
import base64
55
import json
66
import zlib
7-
from typing import Any, AsyncIterator
7+
from collections.abc import AsyncIterator
8+
from typing import Any
89

9-
import airflow
1010
from airflow.triggers.base import BaseTrigger, TriggerEvent
1111
from asgiref.sync import sync_to_async
1212
from packaging.version import Version
1313

14-
from cosmos._utils.watcher_state import build_producer_state_fetcher
15-
16-
AIRFLOW_VERSION = Version(airflow.__version__)
14+
from cosmos.constants import AIRFLOW_VERSION
15+
from cosmos.operators._watcher.state import build_producer_state_fetcher
1716

1817

1918
class WatcherTrigger(BaseTrigger):
@@ -89,23 +88,21 @@ async def get_xcom_val(self, key: str) -> Any | None:
8988
return await self.get_xcom_val_af3(key)
9089

9190
async def _parse_node_status(self) -> str | None:
92-
key = f"nodefinished_{self.model_unique_id.replace('.', '__')}" if self.use_event else "run_results"
93-
94-
compressed_xcom_val = await self.get_xcom_val(key)
95-
if not compressed_xcom_val:
96-
return None
97-
98-
data_json = _parse_compressed_xcom(compressed_xcom_val)
91+
key = (
92+
f"nodefinished_{self.model_unique_id.replace('.', '__')}"
93+
if self.use_event
94+
else f"{self.model_unique_id.replace('.', '__')}_status"
95+
)
9996

10097
if self.use_event:
98+
compressed_xcom_val = await self.get_xcom_val(key)
99+
if not compressed_xcom_val:
100+
return None
101+
102+
data_json = _parse_compressed_xcom(compressed_xcom_val)
101103
return data_json.get("data", {}).get("run_result", {}).get("status") # type: ignore[no-any-return]
102104

103-
results = data_json.get("results", [])
104-
node_result: dict[str, Any] = next(
105-
(r for r in results if r.get("unique_id") == self.model_unique_id),
106-
{},
107-
)
108-
return node_result.get("status")
105+
return await self.get_xcom_val(key)
109106

110107
async def _get_producer_task_status(self) -> str | None:
111108
"""Retrieve the producer task state for both Airflow 2 and Airflow 3."""

cosmos/_utils/importer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import importlib
2-
from typing import Any, Callable
2+
from collections.abc import Callable
3+
from typing import Any
34

45

56
def load_method_from_module(module_path: str, method_name: str) -> Callable[..., Any]:

cosmos/airflow/graph.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
from __future__ import annotations
22

33
from collections import OrderedDict, defaultdict
4+
from collections.abc import Callable
45
from copy import deepcopy
5-
from typing import Any, Callable, Union
6+
from typing import Any
67

78
try: # Airflow 3
89
from airflow.sdk.bases.operator import BaseOperator
@@ -804,7 +805,7 @@ def build_airflow_graph( # noqa: C901 TODO: https://github.com/astronomer/astro
804805
on_warning_callback: Callable[..., Any] | None = None, # argument specific to the DBT test command
805806
async_py_requirements: list[str] | None = None,
806807
execution_config: ExecutionConfig | None = None,
807-
) -> dict[str, Union[TaskGroup, BaseOperator]]:
808+
) -> dict[str, TaskGroup | BaseOperator]:
808809
"""
809810
Instantiate dbt `nodes` as Airflow tasks within the given `task_group` (optional) or `dag` (mandatory).
810811
@@ -829,7 +830,7 @@ def build_airflow_graph( # noqa: C901 TODO: https://github.com/astronomer/astro
829830
and “test_results” of type List.
830831
:return: Dictionary mapping dbt nodes (node.unique_id to Airflow task)
831832
"""
832-
tasks_map: dict[str, Union[TaskGroup, BaseOperator]] = {}
833+
tasks_map: dict[str, TaskGroup | BaseOperator] = {}
833834
task_or_group: TaskGroup | BaseOperator | None
834835

835836
# Identify test nodes that should be run detached from the associated dbt resource nodes because they
@@ -948,7 +949,7 @@ def build_airflow_graph( # noqa: C901 TODO: https://github.com/astronomer/astro
948949

949950
def create_airflow_task_dependencies(
950951
nodes: dict[str, DbtNode],
951-
tasks_map: dict[str, Union[TaskGroup, BaseOperator]],
952+
tasks_map: dict[str, TaskGroup | BaseOperator],
952953
) -> None:
953954
"""
954955
Create the Airflow task dependencies between non-test nodes.

0 commit comments

Comments
 (0)