-
Notifications
You must be signed in to change notification settings - Fork 16
fix(lium): rent full offer gpu_count to avoid split 400 #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -198,6 +198,30 @@ async def test_provision_sends_termination_hours_and_ssh_key() -> None: | |||||||||||||
| assert body["template_id"] == "tpl-1" | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| @respx.mock | ||||||||||||||
| async def test_provision_rents_full_offer_gpu_count_not_spec_minimum() -> None: | ||||||||||||||
| """Lium rejects partial GPU rents on non-splittable executors. | ||||||||||||||
|
|
||||||||||||||
| Live API evidence (2026-07): POST .../rent with gpu_count=1 on an 8-GPU | ||||||||||||||
| machine returns HTTP 400 "Provider doesn't allow GPU splitting.". | ||||||||||||||
| ``InstanceSpec.gpu_count`` is a minimum-need filter; the rent body must | ||||||||||||||
| request the selected offering's full gpu_count (or omit the field). | ||||||||||||||
| """ | ||||||||||||||
| routes = _mock_happy_path() | ||||||||||||||
| multi = Offer( | ||||||||||||||
| id="exec-1", | ||||||||||||||
| gpu_type="RTX A4000", | ||||||||||||||
| gpu_count=8, | ||||||||||||||
| price_per_hour=0.12, | ||||||||||||||
| ) | ||||||||||||||
| await LiumClient("k").provision(_spec(gpu_count=1), offer=multi) | ||||||||||||||
| body = json.loads(routes["rent"].calls.last.request.content) | ||||||||||||||
| assert body.get("gpu_count") != 1 | ||||||||||||||
| assert body.get("gpu_count") in (8, None) | ||||||||||||||
| if "gpu_count" in body: | ||||||||||||||
| assert body["gpu_count"] == multi.gpu_count | ||||||||||||||
|
Comment on lines
+218
to
+222
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Assert the full GPU count explicitly. With Proposed fix- assert body.get("gpu_count") != 1
- assert body.get("gpu_count") in (8, None)
- if "gpu_count" in body:
- assert body["gpu_count"] == multi.gpu_count
+ assert body["gpu_count"] == multi.gpu_count📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| @respx.mock | ||||||||||||||
| async def test_provision_rejects_overpriced_offer_without_rent() -> None: | ||||||||||||||
| rent = respx.post(f"{BASE}/executors/exec-1/rent") | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Reject or filter undersized offers before renting.
_resolve_offerdoes not enforcespec.gpu_count: automatic selection chooses the cheapest offer regardless of GPU count, and explicit offers are returned without validation. This block can therefore rent fewer GPUs than requested instead of failing or selecting a compatible offer.Proposed fix
Also filter automatically selected offers by
candidate.gpu_count >= spec.gpu_count.📝 Committable suggestion
🤖 Prompt for AI Agents