This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v2-11-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v2-11-test by this push:
new 32aa5528164 [v2-11-test] fix missing logs in UI for tasks in
`UP_FOR_RETRY` and `UP_FOR_RESCHEDULE` states (#54547) (#62877)
32aa5528164 is described below
commit 32aa552816456891e7a9cde41bbd9bafd789fa3e
Author: Jarek Potiuk <[email protected]>
AuthorDate: Wed Mar 4 17:17:38 2026 +0100
[v2-11-test] fix missing logs in UI for tasks in `UP_FOR_RETRY` and
`UP_FOR_RESCHEDULE` states (#54547) (#62877)
(cherry picked from commit f7ce3ec21198d9f10a1c6818c640b7097eeebb64)
Co-authored-by: Kirill Romanikhin <[email protected]>
---
airflow/utils/log/file_task_handler.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/airflow/utils/log/file_task_handler.py
b/airflow/utils/log/file_task_handler.py
index a33ab73afc7..57032ecdcc8 100644
--- a/airflow/utils/log/file_task_handler.py
+++ b/airflow/utils/log/file_task_handler.py
@@ -53,6 +53,13 @@ if TYPE_CHECKING:
from airflow.serialization.pydantic.dag_run import DagRunPydantic
from airflow.serialization.pydantic.taskinstance import
TaskInstancePydantic
+_STATES_WITH_COMPLETED_ATTEMPT = frozenset(
+ {
+ TaskInstanceState.UP_FOR_RETRY,
+ TaskInstanceState.UP_FOR_RESCHEDULE,
+ }
+)
+
logger = logging.getLogger(__name__)
@@ -419,7 +426,9 @@ class FileTaskHandler(logging.Handler):
if ti.state in (TaskInstanceState.RUNNING, TaskInstanceState.DEFERRED)
and not has_k8s_exec_pod:
served_messages, served_logs = self._read_from_logs_server(ti,
worker_log_rel_path)
messages_list.extend(served_messages)
- 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