kaxil commented on code in PR #44907:
URL: https://github.com/apache/airflow/pull/44907#discussion_r1888263391


##########
airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -224,7 +226,26 @@ def ti_update_state(
             next_kwargs=ti_patch_payload.trigger_kwargs,
             trigger_timeout=timeout,
         )
+    elif isinstance(ti_patch_payload, TIRescheduleStatePayload):
+        task_instance = session.get(TI, ti_id_str)
+        actual_start_date = timezone.utcnow()
+        # add changes to TaskReschedule table to the session
+        session.add(
+            TaskReschedule(
+                task_instance.task_id,
+                task_instance.dag_id,
+                task_instance.run_id,
+                task_instance.try_number,
+                actual_start_date,
+                task_instance.end_date,

Review Comment:
   Hmm? How would be `end_date`?
   
   Task was set to running in `run` endpoint, it was then running via 
Supervisor/Task Runner, now it caught `AirflowRescheduleException`, so it will 
now set its state to `UP_FOR_RESCHEDULE` along with all the other things on TI 
table  like `end_date, duration`.
   
   You would need something similar to 
   
https://github.com/apache/airflow/blob/38201cf1cfa23a6a363c31f66c39529a2b9b7ae3/airflow/api_fastapi/execution_api/routes/task_instances.py#L205



##########
airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -224,7 +226,26 @@ def ti_update_state(
             next_kwargs=ti_patch_payload.trigger_kwargs,
             trigger_timeout=timeout,
         )
+    elif isinstance(ti_patch_payload, TIRescheduleStatePayload):
+        task_instance = session.get(TI, ti_id_str)
+        actual_start_date = timezone.utcnow()
+        # add changes to TaskReschedule table to the session
+        session.add(
+            TaskReschedule(
+                task_instance.task_id,
+                task_instance.dag_id,
+                task_instance.run_id,
+                task_instance.try_number,
+                actual_start_date,
+                task_instance.end_date,

Review Comment:
   Hmm? How would `end_date` have any value here?
   
   Task was set to running in `run` endpoint, it was then running via 
Supervisor/Task Runner, now it caught `AirflowRescheduleException`, so it will 
now set its state to `UP_FOR_RESCHEDULE` along with all the other things on TI 
table  like `end_date, duration`.
   
   You would need something similar to 
   
https://github.com/apache/airflow/blob/38201cf1cfa23a6a363c31f66c39529a2b9b7ae3/airflow/api_fastapi/execution_api/routes/task_instances.py#L205



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