Skip to content

Commit 781c2d5

Browse files
Julie Ganeshanfacebook-github-bot
authored andcommitted
Strip lines when log-tailing (#973)
Summary: For some reason, certain jobs have logs that end in \n\n, making unreadable whitespace This diff explicitly strips lines before prefixing them, and then manually adds back exactly one "\n" Created from CodeHub with https://fburl.com/edit-in-codehub Reviewed By: haonans, tonykao8080 Differential Revision: D66191123
1 parent a5f840e commit 781c2d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torchx/util/log_tee_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def _print_log_lines_for_role_replica(
102102
color_begin = ""
103103
color_end = ""
104104
prefix = f"{color_begin}{which_role}/{which_replica}{color_end} "
105-
print(_prefix_line(prefix, line), file=dst, end="", flush=True)
105+
print(_prefix_line(prefix, line.strip()), file=dst, end="\n", flush=True)
106106
except Exception as e:
107107
exceptions.put(e)
108108
raise

0 commit comments

Comments
 (0)