amoghrajesh commented on code in PR #45106:
URL: https://github.com/apache/airflow/pull/45106#discussion_r1895913304
##########
airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -359,3 +364,23 @@ def ti_put_rtif(
_update_rtif(task_instance, put_rtif_payload, session)
return {"message": "Rendered task instance fields successfully set"}
+
+
+def _is_eligible_to_retry(task_instance: TI, task_retries: int | None):
Review Comment:
Regarding 2., looking at the code, I think its just safe coding.
We do this:
```
def _is_eligible_to_retry(*, task_instance: TaskInstance):
"""
Is task instance is eligible for retry.
:param task_instance: the task instance
:meta private:
"""
if task_instance.state == TaskInstanceState.RESTARTING:
# If a task is cleared when running, it goes into RESTARTING state
and is always
# eligible for retry
return True
if not getattr(task_instance, "task", None):
# Couldn't load the task, don't know number of retries, guess:
return task_instance.try_number <= task_instance.max_tries
if TYPE_CHECKING:
assert task_instance.task
return task_instance.task.retries and task_instance.try_number <=
task_instance.max_tries
```
So I think we check in the last line, if there are retries defined and
`task_instance.try_number <= task_instance.max_tries` is True, then retry. The
reason is probably because retry can be defined as NONE.
```
retries: int | None = DEFAULT_RETRIES,
```
--
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]