diff --git a/bazel/wrapper_hook/flag_sync.py b/bazel/wrapper_hook/flag_sync.py index b32e5e6c67c..9141c9c3dff 100644 --- a/bazel/wrapper_hook/flag_sync.py +++ b/bazel/wrapper_hook/flag_sync.py @@ -2,6 +2,7 @@ import os import pathlib import sys import time +import traceback from typing import Dict REPO_ROOT = pathlib.Path(__file__).parent.parent.parent @@ -60,6 +61,7 @@ def sync_flags(namespace: str) -> bool: try: sync_and_update(namespace) except Exception: + traceback.print_exc() print("Failed to sync bazel flags. Skipping...") return False wrapper_debug(f"flag sync time: {time.time() - start}") diff --git a/buildscripts/s3_binary/download.py b/buildscripts/s3_binary/download.py index f5db45c0216..219c20b99b9 100644 --- a/buildscripts/s3_binary/download.py +++ b/buildscripts/s3_binary/download.py @@ -51,13 +51,20 @@ def _download_with_curl_or_wget(url: str, out_path: str) -> bool: ) if code == 0: return True + else: + print(f"ERROR: {out}") # wget + print("curl not found, trying wget...") wget = shutil.which("wget") if wget: - code, out = _run([wget, "-q", *(_wget_cert_args()), "-O", out_path, url]) + code, out = _run([wget, "-q", "-O", out_path, url]) if code == 0: return True + else: + print(f"ERROR: {out}") + else: + print("wget not found") return False @@ -80,17 +87,21 @@ def _fetch_remote_sha256_hash(s3_path: str): download_from_s3_with_boto(s3_path + ".sha256", temp_file.name) downloaded = True except Exception: + traceback.print_exc() try: from buildscripts.util.download_utils import download_from_s3_with_requests download_from_s3_with_requests(s3_path + ".sha256", temp_file.name) downloaded = True except Exception: + traceback.print_exc() # curl/wget fallback downloaded = _download_with_curl_or_wget(s3_path + ".sha256", temp_file.name) if downloaded: result = read_sha_file(tempfile_name) + else: + print("ERROR: failed to download remote sha!") if tempfile_name and os.path.exists(tempfile_name): os.unlink(tempfile_name) @@ -153,17 +164,23 @@ def _download_and_verify(s3_path, output_path, remote_sha_allowed, ignore_file_n download_from_s3_with_boto(s3_path, output_path) ok = True except Exception: + traceback.print_exc() try: from buildscripts.util.download_utils import download_from_s3_with_requests download_from_s3_with_requests(s3_path, output_path, raise_on_error=True) ok = True except Exception: + traceback.print_exc() ok = False if not ok: # curl/wget fallback - ok = _download_with_curl_or_wget(s3_path, output_path) + try: + ok = _download_with_curl_or_wget(s3_path, output_path) + except Exception: + traceback.print_exc() + ok = False if not ok: if ignore_file_not_exist: