Skip to content

Commit

Permalink
fix line buffering with low chunk sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
saikonen committed May 27, 2024
1 parent a024c05 commit 216ab1c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion metaflow/datastore/task_datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,17 @@ def stream_logs(
elif len(lines) == 1 and val:
# the chunk did not contain a newline,
# instead the bytes for the logline continue to the next chunk
buffer[k] = val
if v is None:
# if we did not get a new value this round,
# we know to output everything from the buffer.
output[k] = val
else:
# otherwise keep buffering
buffer[k] = val

if not output and buffer:
# we did not have enough data to return yet
continue

yield [(paths[k], v if v is not None else b"") for k, v in output.items()]

Expand Down

0 comments on commit 216ab1c

Please sign in to comment.