Skip to content

Commit 2468ce7

Browse files
committed
add regression report generator
ghstack-source-id: 012d022 Pull-Request: #7094
1 parent d5e6b91 commit 2468ce7

File tree

5 files changed

+459
-1
lines changed

5 files changed

+459
-1
lines changed

aws/lambda/benchmark_regression_summary_report/common/benchmark_time_series_api_model.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import datetime as dt
12
from dataclasses import dataclass, field
2-
from typing import Any, Dict, List
3+
from typing import Any, Dict, List, Optional
34

45
import requests
56

@@ -62,3 +63,24 @@ def from_request(
6263
except Exception as e:
6364
raise RuntimeError(f"Malformed API payload: {e}")
6465
return cls(data=BenchmarkTimeSeriesApiData(time_series=ts, time_range=tr))
66+
67+
68+
def get_latest_meta_info(
69+
time_series: List[BenchmarkTimeSeriesItem],
70+
) -> Optional[dict[str, Any]]:
71+
if not time_series:
72+
return None
73+
74+
pts = [p for s in time_series for p in s.data]
75+
latest = max(
76+
pts,
77+
key=lambda p: dt.datetime.fromisoformat(
78+
p["granularity_bucket"].replace("Z", "+00:00")
79+
),
80+
)
81+
return {
82+
"commit": latest.get("commit", ""),
83+
"branch": latest.get("branch", ""),
84+
"timestamp": latest.get("granularity_bucket", ""),
85+
"workflow_id": latest.get("workflow_id", ""),
86+
}

0 commit comments

Comments
 (0)