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

   
   ### Context
   In the new Task SDK `task_runner`, when a task defines an 
`execution_timeout` and subsequently enters a deferred state, the timeout logic 
reset completely upon resumption. The runner would apply 
`timeout(task.execution_timeout.total_seconds())` without accounting for the 
time the task had already spent executing or deferred, effectively granting a 
fresh timeout window every time it resumed.
   
   ### Changes
   * Updated `_run_execute_callable` in `task_runner.py` to accept the 
`RuntimeTaskInstance` as an argument.
   * Calculated the time elapsed since `ti.start_date` (if available) and 
subtracted it from the total `execution_timeout` to ensure the task's full 
timeout is correctly enforced.
   * Updated the callsite in `_execute_task` to pass `ti` to 
`_run_execute_callable`.
   
   ### Verification
   Added a unit test `test_execution_timeout_with_deferral` to 
`test_task_runner.py` that verifies the runtime timeout logic correctly 
calculates elapsed time and immediately raises `AirflowTaskTimeout` if the task 
has already exceeded the timeout while deferred.
   
   #### closes: #73475
   
   
   * 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