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


##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -1933,9 +1935,19 @@ 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
+        if max_tries > 0:
+            # max_tries is the retry count, not the attempt count -- total 
attempts is max_tries + 1.
+            suffix = f"; retries exhausted ({ti.try_number} of {max_tries + 
1})"

Review Comment:
   Agreed, dropped it. The worker now stores only the policy's own words.
   
   That fixes both things you raised: no more saying the counts twice, and no 
more bare "rate limit, backing off 60s" sitting on a task that was never going 
to retry. The whole max_tries branch is gone, so there's no longer a special 
case to get wrong.
   
   The `retries=0` case is now covered. The old test is parametrized over the 
two ways this branch is reached: budget exhausted (retries=2, try 3) and no 
budget at all (retries=0, try 1). Both expect the plain reason.
   
   Counts are the UI's job now, which it already does in the banner.



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