4
4
python fetch_fluidstack_cloud.py
5
5
"""
6
6
7
- import copy
8
7
import csv
9
8
import json
10
9
import os
19
18
20
19
GPU_MAP = {
21
20
'H100_PCIE_80GB' : 'H100' ,
21
+ 'H100_NVLINK_80GB' : 'H100' ,
22
+ 'A100_NVLINK_80GB' : 'A100-80GB' ,
22
23
'A100_SXM4_80GB' : 'A100-80GB' ,
23
24
'A100_PCIE_80GB' : 'A100-80GB' ,
24
25
'A100_SXM4_40GB' : 'A100' ,
40
41
'RTX_3080_10GB' : 'RTX3080' ,
41
42
}
42
43
43
- CUSTOM_PLANS_CONFIG = [
44
- dict (gpu_count = 1 , cpu_count = 8 , nvme_storage = 750 , ram = 64 ),
45
- dict (gpu_count = 2 , cpu_count = 16 , nvme_storage = 1024 , ram = 128 ),
46
- #dict(gpu_count=4, cpu_count=32, nvme_storage=1200, ram=160),
47
- #dict(gpu_count=8, cpu_count=64, nvme_storage=1500, ram=200)
48
- ]
49
-
50
44
51
45
def get_regions (plans : List ) -> dict :
52
46
"""Return a list of regions where the plan is available."""
@@ -57,45 +51,16 @@ def get_regions(plans: List) -> dict:
57
51
return regions
58
52
59
53
60
- def plans_from_custom_plan (plan : dict ) -> List [dict ]:
61
- prices = dict (cpu = plan ['price' ]['cpu' ]['hourly' ],
62
- ram = plan ['price' ]['ram' ]['hourly' ],
63
- storage = plan ['price' ]['storage' ]['hourly' ],
64
- gpu = plan ['price' ]['gpu' ]['hourly' ])
65
- new_plans = []
66
- for i , config in enumerate (CUSTOM_PLANS_CONFIG ):
67
- new_plan = copy .deepcopy (plan )
68
- price = (prices ['cpu' ] *
69
- config ['cpu_count' ]) + (prices ['ram' ] * config ['ram' ]) + (
70
- prices ['storage' ] * config ['nvme_storage' ]) + (
71
- prices ['gpu' ] * config ['gpu_count' ])
72
- new_plan ['price' ]['hourly' ] = price / config ['gpu_count' ]
73
- new_plan ['configuration' ]['core_count' ] = config ['cpu_count' ]
74
- new_plan ['configuration' ]['ram' ] = config ['ram' ]
75
- new_plan ['configuration' ]['gpu_count' ] = config ['gpu_count' ]
76
- new_plan ['configuration' ]['nvme_storage' ] = config ['nvme_storage' ]
77
- new_plan ['plan_id' ] = f'custom:{ i } :{ plan ["plan_id" ]} '
78
- new_plans .append (new_plan )
79
- return new_plans
80
-
81
-
82
54
def create_catalog (output_dir : str ) -> None :
83
55
response = requests .get (ENDPOINT )
84
56
plans = response .json ()
85
- custom_plans = [
86
- plan for plan in plans if plan ['minimum_commitment' ] == 'hourly' and
87
- plan ['type' ] in ['custom' ] and plan ['gpu_type' ] != 'NO GPU'
88
- ]
89
57
#plans = [plan for plan in plans if len(plan['regions']) > 0]
90
58
plans = [
91
59
plan for plan in plans if plan ['minimum_commitment' ] == 'hourly' and
92
60
plan ['type' ] in ['preconfigured' ] and
93
61
plan ['gpu_type' ] not in ['NO GPU' , 'RTX_3080_10GB' , 'RTX_3090_24GB' ]
94
62
]
95
63
96
- plans = plans + [
97
- plan for plan in custom_plans for plan in plans_from_custom_plan (plan )
98
- ]
99
64
with open (os .path .join (output_dir , 'vms.csv' ), mode = 'w' ,
100
65
encoding = 'utf-8' ) as f :
101
66
writer = csv .writer (f , delimiter = ',' , quotechar = '"' )
@@ -114,7 +79,7 @@ def create_catalog(output_dir: str) -> None:
114
79
try :
115
80
gpu = GPU_MAP [plan ['gpu_type' ]]
116
81
except KeyError :
117
- print (f'Could not map { plan ["gpu_type" ]} ' )
82
+ # print(f'Could not map {plan["gpu_type"]}')
118
83
continue
119
84
gpu_memory = int (
120
85
str (plan ['configuration' ]['gpu_memory' ]).replace ('GB' ,
0 commit comments