amoghrajesh commented on code in PR #73030:
URL: https://github.com/apache/airflow/pull/73030#discussion_r4060007392


##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -1931,9 +1932,15 @@ def _finalize_task_failure(
         if retry_reason is not None:
             retry_kwargs["retry_reason"] = retry_reason[:500]
         return RetryTask(**retry_kwargs), TaskInstanceState.UP_FOR_RETRY
+    if retry_reason is not None and ti._ti_context_from_server is not None:
+        max_tries = ti._ti_context_from_server.max_tries
+        retry_reason = f"{retry_reason}; retries exhausted ({ti.try_number} of 
{max_tries})"

Review Comment:
   Fixed on #73027: the denominator is now `max_tries + 1`, matching `Starting 
attempt %s of %s` in core and the alert template in this same file. The 
`max_tries == 0` case you flagged is handled too — the suffix is skipped 
entirely rather than rendering "(1 of 0)", since there was no budget to exhaust.
   
   ---
   Drafted-by: Claude Opus 5 (1M context); reviewed by @amoghrajesh before 
posting
   



##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -1931,9 +1932,15 @@ def _finalize_task_failure(
         if retry_reason is not None:
             retry_kwargs["retry_reason"] = retry_reason[:500]
         return RetryTask(**retry_kwargs), TaskInstanceState.UP_FOR_RETRY
+    if retry_reason is not None and ti._ti_context_from_server is not None:
+        max_tries = ti._ti_context_from_server.max_tries
+        retry_reason = f"{retry_reason}; retries exhausted ({ti.try_number} of 
{max_tries})"

Review Comment:
   Fixed on #73027: the denominator is now `max_tries + 1`, matching `Starting 
attempt %s of %s` in core and the alert template in this same file. The 
`max_tries == 0` case you flagged is handled too — the suffix is skipped 
entirely rather than rendering "(1 of 0)", since there was no budget to exhaust.
   



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