| """ |
| Busca de instâncias ativas de 4x RTX 4090 e 2x RTX 5090 no Vast.ai. |
| """ |
| import subprocess |
| import json |
|
|
| def get_offers(): |
| cmd = ['/home/j/.local/bin/vastai', 'search', 'offers', 'reliability > 0.94 inet_down > 150 (num_gpus = 4 and gpu_name = RTX_4090) or (num_gpus = 2 and gpu_name = RTX_5090) or (num_gpus = 1 and gpu_name = RTX_5090)', '-o', 'dph', '--raw'] |
| res = subprocess.run(cmd, capture_output=True, text=True) |
| if res.returncode != 0: |
| |
| cmd = ['/home/j/.local/bin/vastai', 'search', 'offers', 'reliability > 0.94 inet_down > 150 dlperf > 150', '-o', 'dph', '--raw'] |
| res = subprocess.run(cmd, capture_output=True, text=True) |
|
|
| offers = json.loads(res.stdout) |
| print(f"Total de ofertas encontradas: {len(offers)}") |
| for o in offers[:8]: |
| name = f"{o.get('num_gpus')}x {o.get('gpu_name')}" |
| dph = round(o.get('dph_total', 0), 3) |
| dlperf = round(o.get('dlperf', 0), 1) |
| net = round(o.get('inet_down', 0)) |
| offer_id = o.get('id') |
| print(f"ID: {offer_id} | {name} | DLPerf: {dlperf} | ${dph}/h | Net: {net} Mbps") |
|
|
| if __name__ == "__main__": |
| get_offers() |
|
|