From 9c353899ebbf4f5b42cde9ea997c166cedc0a6ef Mon Sep 17 00:00:00 2001 From: Mohit Sharma Date: Mon, 11 Mar 2024 19:18:14 +0530 Subject: [PATCH 1/3] add runner failure --- utils/ryzenai/notification_service.py | 53 +++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/utils/ryzenai/notification_service.py b/utils/ryzenai/notification_service.py index f269ee53..711060ee 100644 --- a/utils/ryzenai/notification_service.py +++ b/utils/ryzenai/notification_service.py @@ -136,6 +136,8 @@ def __init__( # Failures and success of the modeling tests self.n_success = sum(r["success"] for r in results.values()) self.n_failures = sum(r["failed"] for r in results.values()) + self.n_category_failures = sum(r["error"] for r in results.values()) + self.n_categories = len(results.keys()) self.n_tests = self.n_failures + self.n_success self.model_results = results @@ -171,6 +173,7 @@ def ci_title_section(self) -> Dict: @property def no_failures(self) -> Dict: + f"🌞 There were no failures: all {self.n_tests} tests passed.\nThe suite ran in {self.time}." return { "type": "section", "text": { @@ -204,12 +207,49 @@ def failures(self) -> Dict: }, } + @property + def runner_failure(self) -> Dict: + if self.n_failures: + text = f"There were {self.n_failures} failures out of {self.n_tests} tests from other categories.\n" + elif self.n_tests > 0: + text = f"All {self.n_tests} tests pass from other categories.\n" + else: + text = "💔 No tests were run!.\n" + + category_failure = [] + for key in self.model_results: + if self.model_results[key]["error"]: + category_failure.append(key) + + text_category = ( + f"The following category tests failed: {' ,'.join(category_failure).strip(',')}.\n" + "Please ensure the communication link is intact, and also investigate other potential causes. Ensure the machine" + "is running, has a stable network connection, and review your workflow for any actions that might impact the runner process." + ) + + return { + "type": "section", + "text": { + "type": "plain_text", + "text": (f"{text_category}\n\n" f"{text}" f"The suite ran in {self.time}."), + "emoji": True, + }, + "accessory": { + "type": "button", + "text": {"type": "plain_text", "text": "Check Action results", "emoji": True}, + "url": f"https://github.com/huggingface/optimum-amd/actions/runs/{os.environ['GITHUB_RUN_ID']}", + }, + } + @property def category_failures(self) -> Dict: category_failures = [] for key in self.model_results: report = self.model_results[key] - report = f"{str(report['failed']).rjust(6)} | {str(report['success']).rjust(7)} | {key}" + if self.model_results[key]["error"]: + report = f"{'-'.rjust(6)} | {'-'.rjust(7)} | {key}" + else: + report = f"{str(report['failed']).rjust(6)} | {str(report['success']).rjust(7)} | {key}" category_failures.append((f"{report}")) header = "Failed | Success | Category \n" @@ -375,13 +415,18 @@ def payload(self) -> str: if self.ci_title: blocks.append(self.ci_title_section) + if self.n_category_failures > 0: + blocks.append(self.runner_failure) + else: + if self.n_failures > 0: + blocks.append(self.failures) + else: + blocks.append(self.no_failures) + if self.n_failures > 0: - blocks.append(self.failures) blocks.append(self.category_failures) for block in self.model_failures: blocks.append(block) - else: - blocks.append(self.no_failures) return json.dumps(blocks) From ec1661945ff6f2cbdb675edd5e4edf39affc164f Mon Sep 17 00:00:00 2001 From: Mohit Sharma Date: Mon, 11 Mar 2024 19:39:16 +0530 Subject: [PATCH 2/3] update msg --- utils/ryzenai/notification_service.py | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/ryzenai/notification_service.py b/utils/ryzenai/notification_service.py index 711060ee..20776557 100644 --- a/utils/ryzenai/notification_service.py +++ b/utils/ryzenai/notification_service.py @@ -223,6 +223,7 @@ def runner_failure(self) -> Dict: text_category = ( f"The following category tests failed: {' ,'.join(category_failure).strip(',')}.\n" + "CI runners have problems! Tests are not run!\n" "Please ensure the communication link is intact, and also investigate other potential causes. Ensure the machine" "is running, has a stable network connection, and review your workflow for any actions that might impact the runner process." ) From 496561e783cf251f5b3668191ea6a6579c208db4 Mon Sep 17 00:00:00 2001 From: Mohit Sharma Date: Mon, 11 Mar 2024 19:40:42 +0530 Subject: [PATCH 3/3] update msg --- utils/ryzenai/notification_service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/ryzenai/notification_service.py b/utils/ryzenai/notification_service.py index 20776557..97abe5fd 100644 --- a/utils/ryzenai/notification_service.py +++ b/utils/ryzenai/notification_service.py @@ -208,7 +208,7 @@ def failures(self) -> Dict: } @property - def runner_failure(self) -> Dict: + def category_error(self) -> Dict: if self.n_failures: text = f"There were {self.n_failures} failures out of {self.n_tests} tests from other categories.\n" elif self.n_tests > 0: @@ -417,7 +417,7 @@ def payload(self) -> str: blocks.append(self.ci_title_section) if self.n_category_failures > 0: - blocks.append(self.runner_failure) + blocks.append(self.category_error) else: if self.n_failures > 0: blocks.append(self.failures)