Pick cheapest GPU SKU and pin the VM to an existing disk AZ.
Scan ru-6 by Nova availability zones (a/b/c). First boot uses FLAVOR_SIZE_PRESET=cheap; reruns stay on the disk segment. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+33
-1
@@ -1,4 +1,4 @@
|
||||
from gpu_rent.pools import PoolGpuOffer, format_pool_scan
|
||||
from gpu_rent.pools import AzGpuOffer, PoolGpuOffer, format_pool_scan
|
||||
|
||||
|
||||
def test_format_pool_scan_recommends_first_hit():
|
||||
@@ -14,9 +14,41 @@ def test_format_pool_scan_recommends_first_hit():
|
||||
matched=[
|
||||
FlavorInfo("1", "GL-4090", 4, 16384, False, {}, "4090-24"),
|
||||
],
|
||||
recommended_az="ru-6a",
|
||||
segments=[
|
||||
AzGpuOffer(
|
||||
az="ru-6a",
|
||||
gpu_labels_found=["4090-24"],
|
||||
gpu_types=["RTX4090"],
|
||||
matched=[FlavorInfo("1", "GL-4090", 4, 16384, False, {}, "4090-24")],
|
||||
),
|
||||
AzGpuOffer(az="ru-6b", gpu_labels_found=[], gpu_types=["H200"], matched=[]),
|
||||
AzGpuOffer(az="ru-6c", gpu_labels_found=[], gpu_types=["H200"], matched=[]),
|
||||
],
|
||||
),
|
||||
]
|
||||
text = "\n".join(format_pool_scan(offers, ("4090-24", "4090-48")))
|
||||
assert "ru-6" in text and "multizone" in text
|
||||
assert "типы:" in text
|
||||
assert "ru-6a" in text and "ru-6b" in text and "ru-6c" in text
|
||||
assert "рекомендация:" in text and "OS_REGION_NAME=ru-6" in text
|
||||
assert "GPU_RENT_AZ=ru-6a" in text
|
||||
|
||||
|
||||
def test_format_pool_scan_pins_disk_az():
|
||||
from gpu_rent.inventory import FlavorInfo
|
||||
|
||||
offers = [
|
||||
PoolGpuOffer(
|
||||
region="ru-6",
|
||||
multizone=True,
|
||||
gpu_labels_found=["4090-24"],
|
||||
gpu_types=["RTX4090"],
|
||||
matched=[FlavorInfo("1", "GL-4090", 4, 16384, False, {}, "4090-24")],
|
||||
recommended_az="ru-6a",
|
||||
)
|
||||
]
|
||||
text = "\n".join(
|
||||
format_pool_scan(offers, ("4090-24",), pin_az="ru-6a", size_preset="cheap")
|
||||
)
|
||||
assert "диск уже в ru-6a" in text
|
||||
|
||||
Reference in New Issue
Block a user