kadubhumika opened a new pull request, #74916:
URL: https://github.com/apache/airflow/pull/74916

   <!-- SPDX-License-Identifier: Apache-2.0
         https://www.apache.org/licenses/LICENSE-2.0 -->
   
   Add `on_success_succeed_dagrun` to teardown tasks, so that a successful 
teardown
   no longer hides a failed work task.
   
   closes: #74727
   
   **Problem**
   
   With `@teardown(on_failure_fail_dagrun=True)` the teardown is the only task 
that
   decides the Dag run state. If a work task fails but the teardown succeeds, 
the
   Dag run is marked SUCCESS and the failure is hidden.
   
   **Fix**
   
   New teardown option `on_success_succeed_dagrun` (default `True`, so existing 
Dags
   behave exactly as before). With `on_failure_fail_dagrun=True` and
   `on_success_succeed_dagrun=False`:
   
   | Work    | Teardown | Dag run |
   |---------|----------|---------|
   | failed  | success  | FAILED  |
   | success | failed   | FAILED  |
   | success | success  | SUCCESS |
   
   **What changed**
   
   - `airflow-core/.../models/dagrun.py`: `_tis_for_dagrun_state` also 
evaluates the
     tasks before a teardown that sets `on_success_succeed_dagrun=False`.
   - `task-sdk` (`@teardown`, `as_teardown()`, `_internal/abstractoperator.py`,
     `_internal/mixins.py`, `xcom_arg.py`, `bases/decorator.py`, 
`bases/operator.py`,
     `mappedoperator.py`): new argument, property and validation, with support 
for
     mapped tasks and `.override()`.
   - `airflow-core/.../serialization/` (`schema.json`, `serialized_objects.py`,
     `definitions/baseoperator.py`, `definitions/mappedoperator.py`,
     `dag_version_diff.py`): the new field is serialized and deserialized.
   - Tests: `test_dagrun.py` covers all six flag and state combinations;
     `test_dag_serialization.py` registers the new serialized field.
   - Newsfragment added.
   
   **Testing**
   
   `test_dagrun.py`, `test_dag_serialization.py` and the task-sdk
   `test_setup_t


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to