This is an automated email from the ASF dual-hosted git repository.
eladkal pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new f7ce3ec2119 fix missing logs in UI for tasks in `UP_FOR_RETRY` and
`UP_FOR_RESCHEDULE` states (#54547)
f7ce3ec2119 is described below
commit f7ce3ec21198d9f10a1c6818c640b7097eeebb64
Author: Kirill Romanikhin <[email protected]>
AuthorDate: Wed Mar 4 14:55:57 2026 +0300
fix missing logs in UI for tasks in `UP_FOR_RETRY` and `UP_FOR_RESCHEDULE`
states (#54547)
---
airflow-core/src/airflow/utils/log/file_task_handler.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/airflow-core/src/airflow/utils/log/file_task_handler.py
b/airflow-core/src/airflow/utils/log/file_task_handler.py
index 60700e1b59c..8aa5136b16c 100644
--- a/airflow-core/src/airflow/utils/log/file_task_handler.py
+++ b/airflow-core/src/airflow/utils/log/file_task_handler.py
@@ -90,6 +90,13 @@ LegacyProvidersLogType: TypeAlias =
list["StructuredLogMessage"] | str | list[st
- For Redis: returns a list of strings.
"""
+_STATES_WITH_COMPLETED_ATTEMPT = frozenset(
+ {
+ TaskInstanceState.UP_FOR_RETRY,
+ TaskInstanceState.UP_FOR_RESCHEDULE,
+ }
+)
+
logger = logging.getLogger(__name__)
@@ -644,7 +651,9 @@ class FileTaskHandler(logging.Handler):
if ti.state in (TaskInstanceState.RUNNING, TaskInstanceState.DEFERRED)
and not has_k8s_exec_pod:
sources, served_logs = self._read_from_logs_server(ti,
worker_log_rel_path)
source_list.extend(sources)
- elif ti.state not in State.unfinished and not (local_logs or
remote_logs):
+ elif (ti.state not in State.unfinished or ti.state in
_STATES_WITH_COMPLETED_ATTEMPT) and not (
+ local_logs or remote_logs
+ ):
# ordinarily we don't check served logs, with the assumption that
users set up
# remote logging or shared drive for logs for persistence, but
that's not always true
# so even if task is done, if no local logs or remote logs are
found, we'll check the worker