Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ydshieh committed May 22, 2024
1 parent 8dc4c6e commit 219df82
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion utils/notification_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ def get_reply_blocks(self, job_name, job_result, failures, device, text):
{"type": "section", "text": {"type": "mrkdwn", "text": failure_text}},
]

def get_new_model_failure_blocks(self, with_header=True):
def get_new_model_failure_blocks(self, with_header=True, truncate=True):
if self.prev_ci_artifacts is None:
return {}

Expand Down Expand Up @@ -675,6 +675,8 @@ def get_new_model_failure_blocks(self, with_header=True):
all_failure_lines[new_text].append(f"<{url}|{device}>" if url is not None else device)

MAX_ERROR_TEXT = 3000 - len("[Truncated]") - len("```New model failures```\n\n")
if not truncate:
MAX_ERROR_TEXT = float("inf")
failure_text = ""
for line, devices in all_failure_lines.items():
new_text = failure_text + f"{'|'.join(devices)} gpu\n{line}"
Expand Down Expand Up @@ -746,6 +748,12 @@ def post_reply(self):

time.sleep(1)

blocks = self.get_new_model_failure_blocks(truncate=False)
failure_text = blocks[-1]["text"]["text"]
file_path = os.path.join(os.getcwd(), f"ci_results_{job_name}/new_model_failures.txt")
with open(file_path, "w", encoding="UTF-8") as fp:
fp.write(failure_text)

blocks = self.get_new_model_failure_blocks()
if blocks:
print("Sending the following reply")
Expand Down

0 comments on commit 219df82

Please sign in to comment.