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

   <!--
   Thank you for contributing!
   -->
   
   ### Description
   
   **Context**
   In the new Airflow 3 Task SDK (`task-sdk`), the `_execute_task` function 
correctly invokes `post_execute` hooks after a task finishes executing. 
However, while it correctly passes the task execution `result` to the 
kwarg-based `_post_execute_hook`, it omits the `result` argument when calling 
an overridden class-level `post_execute` method. 
   
   As a consequence, custom operators migrating to Airflow 3 that override 
`BaseOperator.post_execute(self, context, result=None)` receive `None` instead 
of the actual execution result, or crash entirely if `result` is a required 
positional argument.
   
   closes: #73471
   
   **Changes**
   * Updated `task-sdk/src/airflow/sdk/execution_time/task_runner.py` to pass 
the `result` argument to `post_execute_hook` for class-level overrides.
   * Added `test_post_execute_receives_result` to `test_task_runner.py` to 
ensure `post_execute` is called correctly with the execution result.
   
   **Verification**
   * Added automated tests that verify an overridden `post_execute` method 
successfully receives the exact value returned by the `execute` method during 
the `_run_task_and_map_outcome` flow.
   * Confirmed via local testing that the fix restores the expected Airflow 2 
behavior.
   
   ### PR Checklist
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: 
`{pr_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
 You can add this file in a follow-up commit after the PR is created so you 
know the PR number.
   


-- 
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