Implement balance monitoring and notification for Selectel API integration

- Added support for balance tracking using `SELECTEL_API_TOKEN` in the configuration.
- Introduced new balance notification logic in the local watchdog, alerting users on balance changes based on defined thresholds.
- Updated documentation to include instructions for setting up balance notifications and the required environment variables.
- Enhanced the `ready` and `session` modules to initialize balance state and handle notifications during GPU operations.
- Refactored the CLI and related components to support the new balance monitoring features, ensuring a seamless user experience.
This commit is contained in:
Leonid Pershin
2026-08-21 06:52:51 +03:00
parent 7ed6a99df2
commit 09b7c36f3b
14 changed files with 759 additions and 12 deletions
+14
View File
@@ -194,6 +194,20 @@ def run_tunnel(
else:
open_url = f"http://127.0.0.1:{cfg.swarmui_local_port}"
from gpu_rent.ready import verify_stack_local
try:
local_checks = verify_stack_local(cfg, log, timeout=90.0)
state = load_state()
state.notes = dict(state.notes or {})
state.notes["stack_local"] = [
{"name": c.name, "ok": c.ok, "detail": c.detail} for c in local_checks
]
save_state(state)
except CloudError as exc:
log(f"проверка туннеля: {exc}")
raise
from gpu_rent.access_card import print_access_card
print_access_card(cfg, tunneled=True, host=current_host)