Upload (daily) CI results to Hub (#31168)

* build

* build

* build

* build

* fix

* fix

* fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
Yih-Dar
2024-06-04 21:20:54 +02:00
committed by GitHub
parent 99de3a844b
commit 3714f3f86b
3 changed files with 48 additions and 3 deletions

View File

@@ -13,6 +13,7 @@
# limitations under the License.
import ast
import datetime
import json
import os
import sys
@@ -20,6 +21,7 @@ import time
from typing import Dict
from get_ci_error_statistics import get_jobs
from huggingface_hub import HfApi
from notification_service import (
Message,
handle_stacktraces,
@@ -31,6 +33,7 @@ from notification_service import (
from slack_sdk import WebClient
api = HfApi()
client = WebClient(token=os.environ["CI_SLACK_BOT_TOKEN"])
@@ -249,6 +252,19 @@ if __name__ == "__main__":
with open(f"ci_results_{job_name}/quantization_results.json", "w", encoding="UTF-8") as fp:
json.dump(quantization_results, fp, indent=4, ensure_ascii=False)
target_workflow = "huggingface/transformers/.github/workflows/self-scheduled-caller.yml@refs/heads/main"
is_scheduled_ci_run = os.environ.get("CI_WORKFLOW_REF") == target_workflow
# upload results to Hub dataset (only for the scheduled daily CI run on `main`)
if is_scheduled_ci_run:
api.upload_file(
path_or_fileobj=f"ci_results_{job_name}/quantization_results.json",
path_in_repo=f"{datetime.datetime.today().strftime('%Y-%m-%d')}/ci_results_{job_name}/quantization_results.json",
repo_id="hf-internal-testing/transformers_daily_ci",
repo_type="dataset",
token=os.environ.get("TRANSFORMERS_CI_RESULTS_UPLOAD_TOKEN", None),
)
message = QuantizationMessage(
title,
results=quantization_results,