From b1387ebac95c2e3b2c49ad89f5ad91316815876e Mon Sep 17 00:00:00 2001 From: Robert Schilling Date: Thu, 9 Jan 2025 11:21:52 +0100 Subject: [PATCH] Catch URL error if remote stats bucket does not exist When creating a new IP or moving an IP to ipgen, there is no initial regression run. Consequently, fetching its stats fails as the remote path does not exist. To unblock this error, this PR catches the URL error if the path does not exist and returns that 0 runs out of 0 are performed. Signed-off-by: Robert Schilling --- util/site/fetch_block_stats.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/util/site/fetch_block_stats.py b/util/site/fetch_block_stats.py index 560f04ce0daa8..11f026f829de5 100755 --- a/util/site/fetch_block_stats.py +++ b/util/site/fetch_block_stats.py @@ -8,6 +8,7 @@ and bundles it into one json file. """ from urllib.request import urlopen +from urllib.error import HTTPError import itertools as it import json from pathlib import Path @@ -57,8 +58,12 @@ def parse_report(path: str) -> Tuple[int, int]: - with urlopen(f'https://reports.opentitan.org/{path}/report.json') as response: - report = json.load(response) + try: + with urlopen(f'https://reports.opentitan.org/{path}/report.json') as response: + report = json.load(response) + except HTTPError: + # URL does not exist, there are no test runs yet for that + return (0, 0) # Extract all tests from the report. testpoints = report['results']['testpoints']