diff --git a/autodata_tests/utils/test_native_ci.py b/autodata_tests/utils/test_native_ci.py index e6617c0..781a815 100644 --- a/autodata_tests/utils/test_native_ci.py +++ b/autodata_tests/utils/test_native_ci.py @@ -44,18 +44,25 @@ def native_setup(tmp_path): "while not Path(os.environ['TEST_RELEASE']).exists():\n" " time.sleep(0.01)\n" "assert (cache / 'payload').exists(), 'Active cache was evicted'\n" + "failure = Path(os.environ['TEST_FAIL_ONCE'])\n" + "if failure.exists():\n" + " failure.unlink()\n" + " raise SystemExit(7)\n" "raise SystemExit(int(os.environ.get('TEST_EXIT', '0')))\n" ) uv.chmod(0o755) root = tmp_path / "managed cache" processes = [] - def start(letter, *, hold=False, exit_code=0): + def start(letter, *, hold=False, exit_code=0, fail_once=False): key = f"uv0.12.21-python3.12-cuda12.8.1-8.9-{letter * 64}" started = tmp_path / f"started-{len(processes)}" release = tmp_path / f"release-{len(processes)}" + failure = tmp_path / f"fail-once-{len(processes)}" if not hold: release.touch() + if fail_once: + failure.touch() environment = os.environ.copy() environment.pop("UV_CACHE_DIR", None) process = subprocess.Popen( @@ -68,6 +75,7 @@ def start(letter, *, hold=False, exit_code=0): "NATIVE_CACHE_KEY": key, "TEST_STARTED": str(started), "TEST_RELEASE": str(release), + "TEST_FAIL_ONCE": str(failure), "TEST_EXIT": str(exit_code), }, start_new_session=True, @@ -111,6 +119,12 @@ def test_interrupted_sync_keeps_fallback_and_partial_cache(native_setup, interru assert set((root / "keys").iterdir()) == {b, d} +def test_sync_retries_a_failed_attempt(native_setup): + _, start = native_setup + _, cache, _, _ = start("a", fail_once=True) + assert (cache / ".last-success").is_file() + + def test_concurrent_sync_protects_current_and_only_prunes_managed_keys(native_setup, tmp_path): root, start = native_setup _, a, _, _ = start("a") diff --git a/docker/setup/sync_dependencies.sh b/docker/setup/sync_dependencies.sh index 779f73f..f442d36 100755 --- a/docker/setup/sync_dependencies.sh +++ b/docker/setup/sync_dependencies.sh @@ -25,4 +25,5 @@ args=(--locked) while read -r package; do args+=(--no-install-package "$package") done <<< "$sim_packages" -uv sync "${args[@]}" "$@" +# ovrtx's PyPI sdist downloads its wheel while it builds, outside uv's download retries. +uv sync "${args[@]}" "$@" || { echo "uv sync failed with status $?; retrying once" >&2; uv sync "${args[@]}" "$@"; } diff --git a/scripts/ci/sync_native.sh b/scripts/ci/sync_native.sh index 1612cdb..1f9e4f3 100755 --- a/scripts/ci/sync_native.sh +++ b/scripts/ci/sync_native.sh @@ -41,5 +41,7 @@ done mkdir -p -- "$current" # Failed or interrupted retries must not count as a successful cache use. rm -f -- "$current/.last-success" -UV_CACHE_DIR="$current" UV_LINK_MODE=copy uv sync --locked --group curobo +sync_environment() { UV_CACHE_DIR="$current" UV_LINK_MODE=copy uv sync --locked --group curobo; } +# ovrtx's PyPI sdist downloads its wheel while it builds, outside uv's download retries. +sync_environment || { echo "uv sync failed with status $?; retrying once" >&2; sync_environment; } touch -- "$current/.last-success"