From dbc20379fd7f652710ed5bc2966122bc7fdcd93d Mon Sep 17 00:00:00 2001 From: Tim Conley Date: Wed, 17 Jun 2026 14:18:44 -0700 Subject: [PATCH] Retry release smoke package install --- .github/scripts/install_release_package.py | 34 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/.github/scripts/install_release_package.py b/.github/scripts/install_release_package.py index 723267e2b..45f407c7f 100644 --- a/.github/scripts/install_release_package.py +++ b/.github/scripts/install_release_package.py @@ -6,19 +6,41 @@ import importlib.metadata import subprocess import sys +import time from collections.abc import Sequence +RELEASE_INSTALL_ATTEMPTS = 31 +RELEASE_INSTALL_RETRY_SECONDS = 30 + def _pip_install(args: Sequence[str]) -> None: subprocess.check_call([sys.executable, "-m", "pip", "install", *args]) +def _pip_install_with_retries(args: Sequence[str]) -> None: + for attempt in range(1, RELEASE_INSTALL_ATTEMPTS + 1): + try: + _pip_install(args) + return + except subprocess.CalledProcessError: + if attempt == RELEASE_INSTALL_ATTEMPTS: + raise + print( + "Package was not installable yet; retrying in " + f"{RELEASE_INSTALL_RETRY_SECONDS}s " + f"({attempt}/{RELEASE_INSTALL_ATTEMPTS})", + flush=True, + ) + time.sleep(RELEASE_INSTALL_RETRY_SECONDS) + + def install_package(args: argparse.Namespace) -> None: package = f"temporalio=={args.version}" if args.dependency_index_url: - _pip_install( + _pip_install_with_retries( [ "--prefer-binary", + "--no-cache-dir", "--index-url", args.index_url, "--no-deps", @@ -37,7 +59,15 @@ def install_package(args: argparse.Namespace) -> None: ] ) else: - _pip_install(["--prefer-binary", "--index-url", args.index_url, package]) + _pip_install_with_retries( + [ + "--prefer-binary", + "--no-cache-dir", + "--index-url", + args.index_url, + package, + ] + ) subprocess.check_call([sys.executable, "-m", "pip", "check"])