This is an automated email from the ASF dual-hosted git repository.

damccorm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 2472695eb04 filter out outdated workflow runs (#31071)
2472695eb04 is described below

commit 2472695eb04b4f78e10aa27dcb03c7f214e61496
Author: Andrey Devyatkin <[email protected]>
AuthorDate: Mon Apr 22 21:47:11 2024 +0200

    filter out outdated workflow runs (#31071)
---
 .test-infra/metrics/sync/github/github_runs_prefetcher/code/main.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/.test-infra/metrics/sync/github/github_runs_prefetcher/code/main.py 
b/.test-infra/metrics/sync/github/github_runs_prefetcher/code/main.py
index 35964a5e303..e8fe60b4a7d 100644
--- a/.test-infra/metrics/sync/github/github_runs_prefetcher/code/main.py
+++ b/.test-infra/metrics/sync/github/github_runs_prefetcher/code/main.py
@@ -36,7 +36,7 @@ import uuid
 from psycopg2 import extras
 from ruamel.yaml import YAML
 from github import GithubIntegration
-from datetime import datetime
+from datetime import datetime, timedelta
 
 DB_HOST = os.environ["DB_HOST"]
 DB_PORT = os.environ["DB_PORT"]
@@ -158,10 +158,12 @@ async def check_workflow_flakiness(workflow):
     if not len(workflow.runs):
         return False
 
+    three_months_ago_datetime = datetime.now() - timedelta(days=90)
+    workflow_runs = [run for run in workflow.runs if run.started_at > 
three_months_ago_datetime]
+
     url = f"https://api.github.com/repos/{GIT_ORG}/beam/issues";
     headers = {"Authorization": get_token()}
     semaphore = asyncio.Semaphore(5)
-    workflow_runs = workflow.runs
     params = {
         "state": "closed",
         "labels": f"flaky_test,workflow_id: {workflow.id}",

Reply via email to