jedcunningham commented on code in PR #51592:
URL: https://github.com/apache/airflow/pull/51592#discussion_r2138478586
##########
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:
Is only querying TI the right behavior? Should this also fall back to
history to get the right try? Just setting the try on the TI feels wrong.
--
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]