Add package data for GPU rent and update CLI documentation

- Added package data configuration for the 'gpu_rent' package in pyproject.toml.
- Updated README.md to include usage instructions for Windows and Unix launchers.
- Enhanced CLI documentation in cli.md to reflect new commands and their functionalities.
- Revised setup.md to clarify installation steps and environment setup.
- Improved error handling and command descriptions in the CLI implementation.
- Added new functions for model version handling and flavor resolution in the codebase.
- Updated state management to include additional properties for better tracking.
This commit is contained in:
Leonid Pershin
2026-08-21 03:06:51 +03:00
parent 167d07a733
commit 615cf81493
34 changed files with 2733 additions and 117 deletions
+28
View File
@@ -167,3 +167,31 @@ def pick_boot_image(images: list[Any]) -> Any | None:
return None
ranked.sort(key=lambda item: item[0], reverse=True)
return ranked[0][1]
def resolve_flavor(
flavors: list[Any],
preference: tuple[str, ...],
*,
explicit: str | None = None,
default_id: str | None = None,
fallback: bool = True,
) -> FlavorInfo:
if explicit:
for flavor in flavors:
if _id(flavor) == explicit or _name(flavor) == explicit:
if is_disabled(flavor):
raise ValueError(f"flavor {explicit} disabled")
return flavor_info(flavor, label="explicit")
raise ValueError(f"flavor {explicit} не найден в регионе")
if not fallback:
if not default_id:
raise ValueError("FLAVOR_FALLBACK=false требует DEFAULT_FLAVOR_ID или --flavor")
return resolve_flavor(flavors, preference, explicit=default_id, fallback=True)
gpu = [f for f in flavors if looks_like_gpu(f)]
ranked = rank_flavors(gpu or flavors, preference)
if ranked:
return ranked[0]
if default_id:
return resolve_flavor(flavors, preference, explicit=default_id, fallback=True)
raise ValueError("нет доступного GPU flavor из FLAVOR_PREFERENCE")