You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by pi...@apache.org on 2026/03/04 15:34:14 UTC

(airflow) branch v3-1-test updated: [v3-1-test] fix missing logs in UI for tasks in `UP_FOR_RETRY` and `UP_FOR_RESCHEDULE` states (#54547) (#62862)

This is an automated email from the ASF dual-hosted git repository.

pierrejeambrun pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-1-test by this push:
     new 15a088fd474 [v3-1-test] fix missing logs in UI for tasks in `UP_FOR_RETRY` and `UP_FOR_RESCHEDULE` states (#54547) (#62862)
15a088fd474 is described below

commit 15a088fd474b3a27092cf42827afa7f06b720729
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Wed Mar 4 16:34:05 2026 +0100

    [v3-1-test] fix missing logs in UI for tasks in `UP_FOR_RETRY` and `UP_FOR_RESCHEDULE` states (#54547) (#62862)
    
    (cherry picked from commit f7ce3ec21198d9f10a1c6818c640b7097eeebb64)
    
    Co-authored-by: Kirill Romanikhin <63...@users.noreply.github.com>
---
 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 ae02f579e82..432ecffd460 100644
--- a/airflow-core/src/airflow/utils/log/file_task_handler.py
+++ b/airflow-core/src/airflow/utils/log/file_task_handler.py
@@ -95,6 +95,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__)
 
@@ -647,7 +654,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