Upload new model failure report to Hub (#32264)
upload Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
@@ -520,6 +520,39 @@ class Message:
|
|||||||
if len(new_failure_blocks) > 0:
|
if len(new_failure_blocks) > 0:
|
||||||
blocks.extend(new_failure_blocks)
|
blocks.extend(new_failure_blocks)
|
||||||
|
|
||||||
|
# To save the list of new model failures
|
||||||
|
extra_blocks = self.get_new_model_failure_blocks(to_truncate=False)
|
||||||
|
if extra_blocks:
|
||||||
|
failure_text = extra_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)
|
||||||
|
|
||||||
|
# upload results to Hub dataset
|
||||||
|
file_path = os.path.join(os.getcwd(), f"ci_results_{job_name}/new_model_failures.txt")
|
||||||
|
commit_info = api.upload_file(
|
||||||
|
path_or_fileobj=file_path,
|
||||||
|
path_in_repo=f"{datetime.datetime.today().strftime('%Y-%m-%d')}/ci_results_{job_name}/new_model_failures.txt",
|
||||||
|
repo_id="hf-internal-testing/transformers_daily_ci",
|
||||||
|
repo_type="dataset",
|
||||||
|
token=os.environ.get("TRANSFORMERS_CI_RESULTS_UPLOAD_TOKEN", None),
|
||||||
|
)
|
||||||
|
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"
|
||||||
|
|
||||||
|
block = {
|
||||||
|
"type": "section",
|
||||||
|
"text": {
|
||||||
|
"type": "plain_text",
|
||||||
|
"text": "bonjour",
|
||||||
|
},
|
||||||
|
"accessory": {
|
||||||
|
"type": "button",
|
||||||
|
"text": {"type": "plain_text", "text": "Check New model failures"},
|
||||||
|
"url": url,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
blocks.append(block)
|
||||||
|
|
||||||
return json.dumps(blocks)
|
return json.dumps(blocks)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -765,14 +798,6 @@ class Message:
|
|||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
# To save the list of new model failures
|
|
||||||
blocks = self.get_new_model_failure_blocks(to_truncate=False)
|
|
||||||
if blocks:
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
def retrieve_artifact(artifact_path: str, gpu: Optional[str]):
|
def retrieve_artifact(artifact_path: str, gpu: Optional[str]):
|
||||||
if gpu not in [None, "single", "multi"]:
|
if gpu not in [None, "single", "multi"]:
|
||||||
|
|||||||
Reference in New Issue
Block a user