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


##########
airflow-core/src/airflow/models/taskinstance.py:
##########
@@ -447,6 +447,10 @@ def clear_task_instances(
                 ti.max_tries = max(ti.max_tries, previous_try_number)
             ti.state = None
             ti.external_executor_id = None
+            # retry_delay_override is the functional one: 
next_retry_datetime() prefers it over
+            # the task's own retry_delay, so a stale value would retime the 
next retry.
+            ti.retry_reason = None

Review Comment:
   Handled in a95b421010b



##########
airflow-core/tests/unit/models/test_dagrun.py:
##########
@@ -2949,6 +2955,44 @@ def execute_complete(self):
     assert ti.state == TaskInstanceState.DEFERRED
 
 
[email protected]_serialized_dag
+def test_schedule_tis_start_trigger_clears_retry_policy_columns(dag_maker, 
session):

Review Comment:
   Handled in a95b421010b



##########
airflow-core/src/airflow/models/dagrun.py:
##########
@@ -2296,6 +2296,9 @@ def schedule_tis(
                         state=TaskInstanceState.SCHEDULED,
                         scheduled_dttm=timezone.utcnow(),
                         try_number=next_try_number,
+                        # Already archived with the finished try; the new one 
must not inherit it.
+                        retry_reason=None,
+                        retry_delay_override=None,

Review Comment:
   Handled in a95b421010b



##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/task_instance_history.py:
##########
@@ -68,7 +68,7 @@ class TaskInstanceHistoryResponse(BaseModel):
         default=None,
         validation_alias="retry_reason",
         description=(
-            "The reason the task instance reached its current state, as 
recorded by a retry policy. May describe a previous attempt: it is cleared only 
when the task next starts running, so a task waiting to be retried or re-run 
can still carry the reason its last attempt ended."
+            "The reason the task instance reached its current state, as 
recorded by a retry policy. Describes the attempt that is currently recorded on 
the row: it is cleared when the task is cleared and when the next attempt is 
scheduled or deferred."

Review Comment:
   Handled in a95b421010b



##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/task_instances.py:
##########
@@ -94,7 +94,7 @@ class TaskInstanceResponse(BaseModel):
         default=None,
         validation_alias="retry_reason",
         description=(
-            "The reason the task instance reached its current state, as 
recorded by a retry policy. May describe a previous attempt: it is cleared only 
when the task next starts running, so a task waiting to be retried or re-run 
can still carry the reason its last attempt ended."
+            "The reason the task instance reached its current state, as 
recorded by a retry policy. Describes the attempt that is currently recorded on 
the row: it is cleared when the task is cleared and when the next attempt is 
scheduled or deferred."

Review Comment:
   Handled in a95b421010b



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