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:
Leonid Pershin
2026-08-22 00:06:44 +03:00
co-authored by Cursor
parent 5d0c30f66b
commit 789fa26918
19 changed files with 666 additions and 71 deletions
+23 -3
View File
@@ -183,7 +183,12 @@ def dry_run() -> None:
conn = connect(cfg)
flavors = list(iter_flavors(conn))
gpu = [f for f in flavors if looks_like_gpu(f)]
ranked = rank_flavors(gpu or flavors, cfg.flavor_preference)
ranked = rank_flavors(
gpu or flavors,
cfg.flavor_preference,
size_preset=cfg.flavor_size_preset,
az=cfg.gpu_rent_az,
)
console.print("\n[bold]Flavors[/bold]")
for line in format_flavor_lines(ranked):
console.print(f" {line}")
@@ -201,6 +206,7 @@ def flavors(
) -> None:
"""GPU flavors: скан пулов + список в текущем OS_REGION_NAME."""
try:
from gpu_rent.flavor_presets import format_char_impact
from gpu_rent.inventory import looks_like_gpu, rank_flavors, resolve_flavor
from gpu_rent.os_client import iter_flavors
from gpu_rent.pools import format_pool_scan, scan_pools
@@ -211,20 +217,34 @@ def flavors(
console.print(f"[bold]region сейчас[/bold]: {cfg.os_region_name} / AZ {cfg.gpu_rent_az}")
console.print(f"[bold]SCAN_POOLS[/bold]: {cfg.scan_pools or 'ru-6,ru-7'}")
offers = scan_pools(cfg)
for line in format_pool_scan(offers, cfg.flavor_preference):
for line in format_pool_scan(
offers,
cfg.flavor_preference,
size_preset=cfg.flavor_size_preset,
):
console.print(line)
console.print("")
for line in format_char_impact():
console.print(line)
console.print("")
conn = connect(cfg)
all_f = list(iter_flavors(conn))
gpu = [f for f in all_f if looks_like_gpu(f)]
ranked = rank_flavors(gpu or all_f, cfg.flavor_preference)
ranked = rank_flavors(
gpu or all_f,
cfg.flavor_preference,
size_preset=cfg.flavor_size_preset,
az=cfg.gpu_rent_az,
)
try:
picked = resolve_flavor(
all_f,
cfg.flavor_preference,
default_id=cfg.default_flavor_id or None,
fallback=cfg.flavor_fallback,
size_preset=cfg.flavor_size_preset,
az=cfg.gpu_rent_az,
)
except ValueError:
picked = None