(self)
| 493 | |
| 494 | @property |
| 495 | def payload(self) -> str: |
| 496 | blocks = [self.header] |
| 497 | |
| 498 | if self.ci_title: |
| 499 | blocks.append(self.ci_title_section) |
| 500 | |
| 501 | if self.n_model_failures > 0 or self.n_additional_failures > 0: |
| 502 | blocks.append(self.failures) |
| 503 | |
| 504 | if self.n_model_failures > 0: |
| 505 | blocks.append(self.category_failures) |
| 506 | for block in self.model_failures: |
| 507 | if block["text"]["text"]: |
| 508 | blocks.append(block) |
| 509 | |
| 510 | if self.n_additional_failures > 0: |
| 511 | blocks.append(self.additional_failures) |
| 512 | |
| 513 | if self.n_model_failures == 0 and self.n_additional_failures == 0: |
| 514 | blocks.append(self.no_failures) |
| 515 | |
| 516 | if len(self.selected_warnings) > 0: |
| 517 | blocks.append(self.warnings) |
| 518 | |
| 519 | new_failure_blocks = self.get_new_model_failure_blocks(with_header=False) |
| 520 | if len(new_failure_blocks) > 0: |
| 521 | blocks.extend(new_failure_blocks) |
| 522 | |
| 523 | # To save the list of new model failures |
| 524 | extra_blocks = self.get_new_model_failure_blocks(to_truncate=False) |
| 525 | if extra_blocks: |
| 526 | failure_text = extra_blocks[-1]["text"]["text"] |
| 527 | file_path = os.path.join(os.getcwd(), f"ci_results_{job_name}/new_model_failures.txt") |
| 528 | with open(file_path, "w", encoding="UTF-8") as fp: |
| 529 | fp.write(failure_text) |
| 530 | |
| 531 | # upload results to Hub dataset |
| 532 | file_path = os.path.join(os.getcwd(), f"ci_results_{job_name}/new_model_failures.txt") |
| 533 | commit_info = api.upload_file( |
| 534 | path_or_fileobj=file_path, |
| 535 | path_in_repo=f"{datetime.datetime.today().strftime('%Y-%m-%d')}/ci_results_{job_name}/new_model_failures.txt", |
| 536 | repo_id="hf-internal-testing/transformers_daily_ci", |
| 537 | repo_type="dataset", |
| 538 | token=os.environ.get("TRANSFORMERS_CI_RESULTS_UPLOAD_TOKEN", None), |
| 539 | ) |
| 540 | url = f"https://huggingface.co/datasets/hf-internal-testing/transformers_daily_ci/raw/{commit_info.oid}/{datetime.datetime.today().strftime('%Y-%m-%d')}/ci_results_{job_name}/new_model_failures.txt" |
| 541 | |
| 542 | block = { |
| 543 | "type": "section", |
| 544 | "text": { |
| 545 | "type": "plain_text", |
| 546 | "text": "bonjour", |
| 547 | }, |
| 548 | "accessory": { |
| 549 | "type": "button", |
| 550 | "text": {"type": "plain_text", "text": "Check New model failures"}, |
| 551 | "url": url, |
| 552 | }, |
nothing calls this directly
no test coverage detected