jason810496 commented on code in PR #50175:
URL: https://github.com/apache/airflow/pull/50175#discussion_r2073380307


##########
airflow-core/src/airflow/utils/log/file_task_handler.py:
##########
@@ -474,6 +480,20 @@ def _get_log_retrieval_url(
             hostname = ti.triggerer_job.hostname
             log_relative_path = self.add_triggerer_suffix(log_relative_path, 
job_id=ti.triggerer_job.id)
         else:
+            from airflow.models.taskinstancehistory import TaskInstanceHistory
+
+            ti = (
+                session.query(TaskInstanceHistory)
+                .filter(
+                    TaskInstanceHistory.dag_id == ti.dag_id,
+                    TaskInstanceHistory.task_id == ti.task_id,
+                    TaskInstanceHistory.run_id == ti.run_id,
+                    TaskInstanceHistory.map_index == ti.map_index,
+                    TaskInstanceHistory.try_number == try_number,
+                )
+                .one_or_none()
+                or ti
+            )

Review Comment:
   Should we fetch `TaskInstanceHistory` in the `get_log` endpoint instead of 
making changes here?
   
   
https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/api_fastapi/core_api/routes/public/log.py#L104-L125



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to