Skip to content

Commit

Permalink
Strip lines when log-tailing
Browse files Browse the repository at this point in the history
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

Differential Revision: D66191123
  • Loading branch information
Julie Ganeshan authored and facebook-github-bot committed Nov 20, 2024
1 parent 5ad30fe commit 84ba5af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torchx/util/log_tee_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _print_log_lines_for_role_replica(
color_begin = ""
color_end = ""
prefix = f"{color_begin}{which_role}/{which_replica}{color_end} "
print(_prefix_line(prefix, line), file=dst, end="", flush=True)
print(_prefix_line(prefix, line.strip()), file=dst, end="\n", flush=True)
except Exception as e:
exceptions.put(e)
raise
Expand Down

0 comments on commit 84ba5af

Please sign in to comment.