uranusjr commented on code in PR #70671:
URL: https://github.com/apache/airflow/pull/70671#discussion_r4410310287


##########
airflow-core/src/airflow/utils/log/file_task_handler.py:
##########
@@ -647,21 +645,22 @@ def _read(
             TaskInstanceState.DEFERRED,
         )
 
-        with LogStreamAccumulator(out_stream, HEAP_DUMP_SIZE) as 
stream_accumulator:
-            log_pos = stream_accumulator.total_lines
-            out_stream = stream_accumulator.stream
-
-            # skip log stream until the last position
-            if metadata and "log_pos" in metadata:
-                out_stream = islice(out_stream, metadata["log_pos"], None)
-            else:
-                # first time reading log, add messages before interleaved log 
stream
-                out_stream = chain(header, out_stream)
+        out_metadata: LogMetadata = {"end_of_log": end_of_log}
+        if not end_of_log:
+            # Only an unfinished read needs log_pos for the continuation 
token, and counting
+            # lines drains the stream eagerly, so finished reads stream 
straight through.

Review Comment:
   ```suggestion
               # Counting lines for log_pos drains the stream; skip when no 
token is needed.
   ```



-- 
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]

Reply via email to