Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion airflow-core/src/airflow/utils/log/log_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class TaskLogReader:

STREAM_LOOP_SLEEP_SECONDS = 1
"""Time to sleep between loops while waiting for more logs"""
STREAM_LOOP_STOP_AFTER_EMPTY_ITERATIONS = 5

STREAM_LOOP_STOP_AFTER_EMPTY_ITERATIONS = 10
"""Number of empty loop iterations before stopping the stream"""

def read_log_chunks(
Expand Down
8 changes: 2 additions & 6 deletions airflow-core/tests/unit/utils/log/test_log_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,7 @@ def test_read_log_stream_should_read_each_try_in_turn(self, mock_read):
def test_read_log_stream_no_end_of_log_marker(self, mock_read):
mock_read.side_effect = [
(["hello"], {"end_of_log": False}),
([], {"end_of_log": False}),
([], {"end_of_log": False}),
([], {"end_of_log": False}),
([], {"end_of_log": False}),
([], {"end_of_log": False}),
*[([], {"end_of_log": False}) for _ in range(10)],
]

self.ti.state = TaskInstanceState.SUCCESS
Expand All @@ -237,7 +233,7 @@ def test_read_log_stream_no_end_of_log_marker(self, mock_read):
"hello\n",
"(Log stream stopped - End of log marker not found; logs may be incomplete.)\n",
]
assert mock_read.call_count == 6
assert mock_read.call_count == 11

def test_supports_external_link(self):
task_log_reader = TaskLogReader()
Expand Down