Improve logging in build_download_helper

This commit is contained in:
Mikhail f. Shiryaev 2024-03-19 13:27:26 +01:00
parent 5e5a39d039
commit 6b43d2e197
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4

View File

@ -120,12 +120,14 @@ def read_build_urls(build_name: str, reports_path: Union[Path, str]) -> List[str
for root, _, files in os.walk(reports_path):
for file in files:
if file.endswith(f"_{build_name}.json"):
logging.info("Found build report json %s", file)
logging.info("Found build report json %s for %s", file, build_name)
with open(
os.path.join(root, file), "r", encoding="utf-8"
) as file_handler:
build_report = json.load(file_handler)
return build_report["build_urls"] # type: ignore
logging.info("A build report is not found for %s", build_name)
return []
@ -197,7 +199,7 @@ def download_builds_filter(
):
build_name = get_build_name_for_check(check_name)
urls = read_build_urls(build_name, reports_path)
print(urls)
logging.info("The build report for %s contains the next URLs: %s", build_name, urls)
if not urls:
raise DownloadException("No build URLs found")
@ -223,6 +225,21 @@ def download_clickhouse_binary(check_name, reports_path, result_path):
)
def get_clickhouse_binary_url(check_name, reports_path):
build_name = get_build_name_for_check(check_name)
urls = read_build_urls(build_name, reports_path)
logging.info("The build report for %s contains the next URLs: %s", build_name, urls)
for url in urls:
check_url = url
if "?" in check_url:
check_url = check_url.split("?")[0]
if check_url.endswith("clickhouse"):
return url
return None
def download_performance_build(check_name, reports_path, result_path):
download_builds_filter(
check_name,