[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
This commit is contained in:
Aiden Grossman 2025-02-14 19:12:16 -08:00 committed by GitHub
parent f7a2d70bd9
commit 97d2cfeab3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)