Skip to content

Commit 3b04aeb

Browse files
authored
[Benchmarks] Archive old data (#19128)
Archive old benchmark data so it is not loaded in the dashboard. The default value for archiving is: - for Baseline_* runs for data older than 30 days, - for all other runs for data older than 7 days. A new archive toggle: ![image](https://github.com/user-attachments/assets/5e3dcd77-9f0c-4ab5-8ae9-918d0a17e58e) Test data chart with shortened archiving time of Baseline to 30 days ("Include archived data" not triggered): ![image](https://github.com/user-attachments/assets/96dcf56b-f552-42a6-a4b1-c7ed9c996d7c) And with archived data loaded: ![image](https://github.com/user-attachments/assets/e4481f33-043d-4d7c-925f-87deb91f5ce0)
1 parent bb3e585 commit 3b04aeb

File tree

6 files changed

+255
-74
lines changed

6 files changed

+255
-74
lines changed

devops/scripts/benchmarks/history.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import socket
1010
from utils.result import Result, BenchmarkRun
1111
from options import Compare, options
12-
from datetime import datetime, timezone
12+
from datetime import datetime, timezone, timedelta
1313
from utils.utils import run
1414
from utils.validate import Validate
1515

@@ -223,3 +223,27 @@ def get_compare(self, name: str) -> BenchmarkRun:
223223
return self.compute_average(data)
224224

225225
raise Exception("invalid compare type")
226+
227+
def partition_runs_by_age(self) -> tuple[list[BenchmarkRun], list[BenchmarkRun]]:
228+
"""
229+
Partition runs into current and archived based on their age.
230+
Returns:
231+
tuple: (current_runs, archived_runs)
232+
"""
233+
current_runs = []
234+
archived_runs = []
235+
236+
for run in self.runs:
237+
archive_after = (
238+
options.archive_baseline_days
239+
if run.name.startswith("Baseline_")
240+
else options.archive_pr_days
241+
)
242+
cutoff_date = datetime.now(timezone.utc) - timedelta(days=archive_after)
243+
244+
if run.date > cutoff_date:
245+
current_runs.append(run)
246+
else:
247+
archived_runs.append(run)
248+
249+
return current_runs, archived_runs

devops/scripts/benchmarks/html/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ <h3>Display Options</h3>
5353
<input type="checkbox" id="custom-range">
5454
Adjust Y-axis for comparisons
5555
</label>
56+
<label title="Load older benchmark results that have been archived.">
57+
<input type="checkbox" id="show-archived-data">
58+
Include archived runs
59+
</label>
5660
</div>
5761
</div>
5862

0 commit comments

Comments
 (0)