fix(wheels): disable cooldown for local and cache wheel servers by having separate cache wheel resolution from pre-built path - #1141
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe PR threads a new cache_wheel_server_url through build and download paths, adds resolve_cached_wheel and cache-first resolution to prefer local/cache servers when locating prebuilt wheels, and updates acquisition to use a local cached file when the resolved URL is the local wheel server. resolve_all_prebuilt_wheels no longer special-cases local servers for upload-time support. Tests were added/updated to assert that local and cache wheel servers skip cooldown warnings while external servers retain cooldown behavior. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/fromager/wheels.py`:
- Around line 556-565: The equality checks against ctx.wheel_server_url and
cache_wheel_server_url can fail due to URL normalization differences (trailing
slashes, etc.); update the comparisons in the block that assigns
provider.cooldown to None so they compare normalized URLs instead of raw strings
— normalize `url`, `ctx.wheel_server_url`, and `cache_wheel_server_url` (e.g.,
parse and rebuild or at minimum strip trailing slashes and ensure consistent
scheme/netloc/path) before doing the equality checks, and then set
provider.cooldown = None when the normalized values match.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 13501074-a382-4bd6-bbb9-92f828557ff1
📒 Files selected for processing (3)
src/fromager/commands/build.pysrc/fromager/wheels.pytests/test_cooldown.py
|
This PR feels like a hack on top of a hack. The code is becoming increasingly confusing and hard to understand. I think the root cause of the issue is the fact that code paths are mixing cache wheel server and PyPI server for pre-built wheels. Cache lookup is using the same code path as pre-built download. At least that's what I think is happening... |
LalatenduMohanty
left a comment
There was a problem hiding this comment.
We should change this PR to use PyPICacheProvider for both the local and cache wheel server URLs inside resolve_all_prebuilt_wheels, rather than conditionally nulling out cooldown after the fact. refer #1143
f1ca260 to
eae3f0d
Compare
eae3f0d to
85b2780
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
85b2780 to
19c9cd9
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/fromager/commands/build.py (1)
524-532: 💤 Low valueLog wording: "prebuilt" no longer matches the function's scope.
_is_wheel_builtnow covers cache/local candidates too, not just prebuilt wheels. The "could not locate prebuilt wheel" log messages at lines 526 and 531 will be misleading when the failure is for a cache hit. Consider "existing" to match line 488.♻️ Suggested change
- logger.debug( - "could not locate prebuilt wheel %s-%s", - dist_name, - resolved_version, - exc_info=True, - ) - logger.info("could not locate prebuilt wheel") + logger.debug( + "could not locate existing wheel %s-%s", + dist_name, + resolved_version, + exc_info=True, + ) + logger.info("could not locate existing wheel")🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/fromager/commands/build.py` around lines 524 - 532, The logs in _is_wheel_built incorrectly say "prebuilt wheel" while the function also checks cache/local candidates; update both logger calls that reference dist_name and resolved_version (the logger.debug with exc_info and the logger.info that returns None) to use wording like "existing wheel" or "existing candidate" (consistent with earlier "existing" wording at line 488) so messages accurately reflect cache/local/prebuilt scope.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/fromager/commands/build.py`:
- Around line 481-489: The call to wheels.resolve_existing_wheel is currently
executed before the try/except in _is_wheel_built, so any exceptions (e.g.,
transient network errors) escape and abort the build; move the
resolve_existing_wheel(...) invocation into the existing try block that
surrounds the logic at lines 491+ so that exceptions are caught and the function
returns None (falling back to source build) as before—adjust references to
ctx=wkctx, req=req, pbi=pbi, cache_wheel_server_url=cache_wheel_server_url and
preserve the existing logger.info("could not locate existing wheel")/return None
flow inside the except path.
---
Nitpick comments:
In `@src/fromager/commands/build.py`:
- Around line 524-532: The logs in _is_wheel_built incorrectly say "prebuilt
wheel" while the function also checks cache/local candidates; update both logger
calls that reference dist_name and resolved_version (the logger.debug with
exc_info and the logger.info that returns None) to use wording like "existing
wheel" or "existing candidate" (consistent with earlier "existing" wording at
line 488) so messages accurately reflect cache/local/prebuilt scope.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d96726c4-5302-4336-905e-1d3f306b488c
📒 Files selected for processing (4)
src/fromager/commands/build.pysrc/fromager/commands/download_sequence.pysrc/fromager/wheels.pytests/test_cooldown.py
🚧 Files skipped from review as they are similar to previous changes (3)
- tests/test_cooldown.py
- src/fromager/commands/download_sequence.py
- src/fromager/wheels.py
19c9cd9 to
128b1b2
Compare
128b1b2 to
8862a7e
Compare
8862a7e to
a7aba28
Compare
rd4398
left a comment
There was a problem hiding this comment.
This looks good! I will wait for @LalatenduMohanty to approve since he requested changes before
|
The function
|
Use PyPICacheProvider (introduced in #1143) for local and cache wheel server lookups in the build and download-sequence paths. This separates trusted internal sources (no cooldown, no upload-time checks) from upstream pre-built sources. - Add resolve_cached_wheel() using PyPICacheProvider - Simplify _is_wheel_built() to only check cache servers (local + cache_wheel_server) via resolve_cached_wheel - Route download_sequence local server through resolve_cached_wheel - Remove supports_upload_time workaround from resolve_all_prebuilt_wheels - Add tests for cache/local cooldown bypass and upstream cooldown retention Follows up on #1143 and addresses maintainer feedback from #1141. Co-Authored-By: Claude <claude@anthropic.com> Signed-off-by: Shanmukh Pawan <smoparth@redhat.com>
a7aba28 to
6b21905
Compare
✅ Branch has been successfully rebased |
1e994cd to
1a741c6
Compare
There was a problem hiding this comment.
@smoparth Any package configured with a per-package wheel_server_url in its settings YAML (e.g.):
settings/some-pkg.yaml
wheel_server_url: https://custom-wheel.test/simple/
will no longer have that custom server checked for existing wheels in _is_wheel_built(). The function will only check the local and cache servers, won't find the wheel there, and proceed to rebuild the package from source unnecessarily.
Because the new _is_wheel_built() at src/fromager/commands/build.py:473-476 builds its server list like this:
cache_servers: list[str] = list(
filter(None, [wkctx.wheel_server_url, cache_wheel_server_url])
)
It only considers the global local server and the cache server. pbi.wheel_server_url is never consulted. The call to get_wheel_server_urls() was removed from _build() entirely
|
Also we should add a test test for the pbi.wheel_server_url path. |
|
This pull request has merge conflicts that must be resolved before it can be merged. |
1a741c6 to
d4433f4
Compare
rd4398
left a comment
There was a problem hiding this comment.
The architectural direction is right, separating cache resolution from pre-built resolution at the provider level is cleaner than the supports_upload_time = False workaround. The test coverage is also strong. I have left some comments after which this should be good to land
d4433f4 to
9fee803
Compare
rd4398
left a comment
There was a problem hiding this comment.
LGTM!
We should merge this as soon as possible as it is blocking downstream work for us.
The local wheel server and --cache-wheel-server-url only hold wheels Fromager already built. Cooldown was applied when the sdist was resolved. The cache upload-time is when we uploaded the wheel, not when the package was published, so --min-release-age rejects a wheel we should reuse. A package wheel_server_url is an upstream pre-built index, so that lookup stays on the pre-built path and cooldown still applies. Follows up on #1143 and closes #1140. Co-Authored-By: Claude <claude@anthropic.com> Co-Authored-By: Cursor Grok 4.7 <noreply@x.ai> Signed-off-by: Shanmukh Pawan <smoparth@redhat.com>
9fee803 to
20999a0
Compare
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Use PyPICacheProvider (introduced in #1143) for trusted local and cache wheel server lookups in the build and download-sequence paths. A package wheel_server_url stays on the pre-built path, where the release-age cooldown still applies.
Follows up on #1143 and closes #1140.
Pull Request Description
What
Why