Commit 908e12f
authored
fix(graph): forward
## Description
`RenderConfig.exclude` was only applied to the **aggregate test task**
created for `TestBehavior.AFTER_ALL`. For `AFTER_EACH` / `BUILD`, the
per-model and detached (multiple-parents) test tasks ignored it — so an
exclusion such as `exclude=["resource_type:unit_test"]` did **not** stop
unit tests from running, and users had to repeat the exclusion in
`operator_args` (e.g. `dbt_cmd_flags`) as a workaround.
### Fix
- `create_test_task_metadata()` now forwards `render_config.exclude` in
the **node** (per-model / detached) branch too, via a small
`forward_render_exclude_to_test()` helper.
- `generate_task_or_group()` passes `render_config` through to the
`AFTER_EACH` test task (it previously wasn't, which is why the node
branch never saw the exclusion).
Exclusions are purely additive, so forwarding them is safe. `select` /
`selector` are **intentionally** still only forwarded for `AFTER_ALL` —
combining a global selection with the per-model selection would require
resolving dbt's union/intersection set semantics, which Cosmos does not
attempt. This limitation is now documented in `selecting-excluding.rst`.
### Behavior (validated by the new integration test,
`MULTIPLE_PARENTS_TEST_DBT_PROJECT` with
`exclude=["resource_type:unit_test"]`)
| Test task | `--exclude` before | `--exclude` after |
|---|---|---|
| `combined_model.test` (parent of detached test) | `custom_test_…` |
`resource_type:unit_test custom_test_…` |
| `model_a.test` (parent) | `custom_test_…` | `resource_type:unit_test
custom_test_…` |
| `model_b.test` (not a parent) | _(none)_ | `resource_type:unit_test` |
| detached multi-parent test | _(none)_ | `resource_type:unit_test` |
## Related Issue(s)
Closes #1763
Relates to #1865 (already closed)
## Context
This is a smaller **re-implementation of #2006** (by @anyapriya, which
went stale) against the **current, refactored** graph code. The two
pieces #2006 carried — the `detached_from_parent: dict[str,
list[DbtNode]]` type-hint fix and avoiding render-config mutation — are
already on `main` (the latter via the `_convert_list_to_str` helper), so
this PR only needs the exclude-forwarding. Credit to @anyapriya for the
original fix and tests, which this preserves.
## Breaking Change?
No.
## Checklist
- [x] I have made corresponding changes to the documentation
- [x] I have added tests that prove my fix is effective (unit tests in
`tests/airflow/test_graph.py`; integration test in
`tests/test_converter.py`)
🤖 Generated with [Claude Code](https://claude.com/claude-code)RenderConfig.exclude to test tasks for all test behaviors (#2850)1 parent cafb34d commit 908e12f
4 files changed
Lines changed: 259 additions & 9 deletions
File tree
- cosmos/airflow
- docs/guides/translate_dbt_to_airflow
- tests
- airflow
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
131 | 140 | | |
132 | 141 | | |
133 | 142 | | |
| |||
140 | 149 | | |
141 | 150 | | |
142 | 151 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 152 | + | |
151 | 153 | | |
152 | 154 | | |
153 | 155 | | |
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
157 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
158 | 178 | | |
159 | 179 | | |
160 | 180 | | |
| |||
189 | 209 | | |
190 | 210 | | |
191 | 211 | | |
192 | | - | |
| 212 | + | |
193 | 213 | | |
| 214 | + | |
| 215 | + | |
194 | 216 | | |
195 | 217 | | |
196 | 218 | | |
| |||
212 | 234 | | |
213 | 235 | | |
214 | 236 | | |
| 237 | + | |
| 238 | + | |
215 | 239 | | |
216 | 240 | | |
217 | 241 | | |
| |||
430 | 454 | | |
431 | 455 | | |
432 | 456 | | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
433 | 461 | | |
434 | 462 | | |
435 | 463 | | |
| |||
678 | 706 | | |
679 | 707 | | |
680 | 708 | | |
| 709 | + | |
681 | 710 | | |
682 | 711 | | |
683 | 712 | | |
| |||
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
148 | 176 | | |
149 | 177 | | |
150 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
827 | 827 | | |
828 | 828 | | |
829 | 829 | | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
830 | 854 | | |
831 | 855 | | |
832 | 856 | | |
| |||
1313 | 1337 | | |
1314 | 1338 | | |
1315 | 1339 | | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
1316 | 1440 | | |
1317 | 1441 | | |
1318 | 1442 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
380 | 449 | | |
381 | 450 | | |
382 | 451 | | |
| |||
0 commit comments