From 97d2cfeab3dc938f28e2af4f2deff6a82ac58c5e Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Fri, 14 Feb 2025 19:12:16 -0800 Subject: [PATCH] [CI] Try Moving Github Object Into Loop Currently the metrics container is crashing reasonably often with incomplete read/connection broken errors. Try moving the creation of the Github Object into the main loop to see if recreating the object that maybe handles some connection state fixes the issue. Reviewers: Keenuts, lnihlen Reviewed By: lnihlen Pull Request: https://github.com/llvm/llvm-project/pull/127276 --- .ci/metrics/metrics.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.ci/metrics/metrics.py b/.ci/metrics/metrics.py index ed7b908399ab..09e00b3647d2 100644 --- a/.ci/metrics/metrics.py +++ b/.ci/metrics/metrics.py @@ -255,8 +255,6 @@ def upload_metrics(workflow_metrics, metrics_userid, api_key): def main(): # Authenticate with Github auth = Auth.Token(os.environ["GITHUB_TOKEN"]) - github_object = Github(auth=auth) - github_repo = github_object.get_repo("llvm/llvm-project") grafana_api_key = os.environ["GRAFANA_API_KEY"] grafana_metrics_userid = os.environ["GRAFANA_METRICS_USERID"] @@ -268,6 +266,9 @@ def main(): # Enter the main loop. Every five minutes we wake up and dump metrics for # the relevant jobs. while True: + github_object = Github(auth=auth) + github_repo = github_object.get_repo("llvm/llvm-project") + current_metrics = get_per_workflow_metrics(github_repo, workflows_to_track) current_metrics += get_sampled_workflow_metrics(github_repo)