dstandish commented on code in PR #51592:
URL: https://github.com/apache/airflow/pull/51592#discussion_r2138483596


##########
airflow-core/src/airflow/utils/log/file_task_handler.py:
##########
@@ -180,15 +181,18 @@ def _interleave_logs(*logs: str | LogMessages) -> 
Iterable[StructuredLogMessage]
         last = msg
 
 
-def _ensure_ti(ti: TaskInstanceKey | TaskInstance, session) -> TaskInstance:
+def _ensure_ti(
+    ti: TaskInstanceKey | TaskInstance | TaskInstanceHistory, session
+) -> TaskInstance | TaskInstanceHistory:
     """
-    Given TI | TIKey, return a TI object.
+    Return a TaskInstance or TaskInstanceHistory for the given TI, TIKey, or 
TaskInstanceHistory.
 
-    Will raise exception if no TI is found in the database.
+    Raises AirflowException if no TI is found in the database.
     """
     from airflow.models.taskinstance import TaskInstance
+    from airflow.models.taskinstancehistory import TaskInstanceHistory
 
-    if isinstance(ti, TaskInstance):
+    if isinstance(ti, (TaskInstance, TaskInstanceHistory)):
         return ti
     val = (

Review Comment:
   i suppose it depends on the context. in execution context, should be fine?



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