seanghaeli commented on code in PR #77086:
URL: https://github.com/apache/airflow/pull/77086#discussion_r4761651115


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/triggers.py:
##########
@@ -151,19 +200,35 @@ def _build_response(
     task_instance = None
     if kind == TriggerKind.TASK:
         ti = trigger.task_instance
-        if ti is None or (map_index := public_map_indexes.get(ti.id)) is None:
-            # Its task instance was deleted (with its Dag or run) after the 
page was read.
+        if ti is not None and (map_index := public_map_indexes.get(ti.id)) is 
not None:
+            task_instance = TriggerTaskInstanceReferenceResponse(
+                dag_id=ti.dag_id,
+                dag_run_id=ti.run_id,
+                task_id=ti.task_id,
+                map_index=map_index,
+                try_number=ti.try_number,
+                state=ti.state,
+            )
+        elif trigger.finished_at is None:

Review Comment:
   A finished task trigger is listed now, but nothing says which task it was 
for. In Breeze a deferred task's failed trigger came back as `finished` with 
its error, yet `task_instance` was null, so Used By was empty in the list and 
on the trigger page, even though the failed task instance was still there and 
`used_by_ref` still had its `ti_id`. Could we look the task instance up by that 
`ti_id` when the trigger is finished?



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