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


##########
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:
   `max_tries` is the retry count, so total attempts is `max_tries + 1`. 
Changed the denominator to `max_tries + 1` and updated the two tests that 
asserted (2 of 2) to use the reachable `try_number=3`, `max_tries=2`combo 
instead.



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