maproom 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. maproom/__init__.py +14 -0
  2. maproom/__main__.py +10 -0
  3. maproom/analyze/__init__.py +1 -0
  4. maproom/analyze/accel_families.py +45 -0
  5. maproom/analyze/account_azure_activity.py +260 -0
  6. maproom/analyze/account_azure_quota_requests.py +177 -0
  7. maproom/analyze/account_cloudtrail.py +316 -0
  8. maproom/analyze/account_quota_requests.py +180 -0
  9. maproom/analyze/analyze_v1_orchestration.py +1194 -0
  10. maproom/analyze/catalog.py +353 -0
  11. maproom/analyze/change_detection.py +652 -0
  12. maproom/analyze/context_client.py +99 -0
  13. maproom/analyze/context_lookup.py +142 -0
  14. maproom/analyze/cover_analyze.py +344 -0
  15. maproom/analyze/cover_client.py +65 -0
  16. maproom/analyze/cover_lookup.py +242 -0
  17. maproom/analyze/engine.py +644 -0
  18. maproom/analyze/fleetfit_endpoints.py +217 -0
  19. maproom/analyze/fleetfit_policy.py +66 -0
  20. maproom/analyze/instance_price_analyze.py +221 -0
  21. maproom/analyze/instance_price_client.py +108 -0
  22. maproom/analyze/instance_price_lookup.py +60 -0
  23. maproom/analyze/local_reads.py +484 -0
  24. maproom/analyze/lookup_http.py +280 -0
  25. maproom/analyze/metric_format.py +20 -0
  26. maproom/analyze/migration_method.py +130 -0
  27. maproom/analyze/move_list.py +93 -0
  28. maproom/analyze/operator_context.py +156 -0
  29. maproom/analyze/performance_rank.py +97 -0
  30. maproom/analyze/primary_recommendation.py +422 -0
  31. maproom/analyze/provider_comparison.py +401 -0
  32. maproom/analyze/quota_analyze.py +481 -0
  33. maproom/analyze/quota_client.py +75 -0
  34. maproom/analyze/quota_lookup.py +110 -0
  35. maproom/analyze/quota_outcome_steer.py +105 -0
  36. maproom/analyze/recommend_batch.py +199 -0
  37. maproom/analyze/recommend_client.py +362 -0
  38. maproom/analyze/recommend_share.py +118 -0
  39. maproom/analyze/recommendation.py +591 -0
  40. maproom/analyze/reservation_pack.py +883 -0
  41. maproom/analyze/reservation_read.py +461 -0
  42. maproom/analyze/safe_analyze.py +1134 -0
  43. maproom/analyze/safe_move.py +195 -0
  44. maproom/analyze/safe_moves.py +571 -0
  45. maproom/analyze/safe_moves_catalog.py +127 -0
  46. maproom/analyze/safe_moves_client.py +70 -0
  47. maproom/analyze/series_analyze.py +491 -0
  48. maproom/analyze/series_client.py +106 -0
  49. maproom/analyze/series_lookup.py +663 -0
  50. maproom/analyze/shape.py +254 -0
  51. maproom/analyze/size_analyze.py +883 -0
  52. maproom/analyze/size_client.py +81 -0
  53. maproom/analyze/size_keep.py +409 -0
  54. maproom/analyze/size_lookup.py +368 -0
  55. maproom/analyze/specs.py +325 -0
  56. maproom/analyze/spot_analyze.py +392 -0
  57. maproom/analyze/spot_client.py +74 -0
  58. maproom/analyze/spot_lookup.py +213 -0
  59. maproom/analyze/token_client.py +97 -0
  60. maproom/analyze/utilization.py +190 -0
  61. maproom/analyze/workload.py +104 -0
  62. maproom/analyze/workset.py +762 -0
  63. maproom/aws_region.py +78 -0
  64. maproom/cache/__init__.py +1 -0
  65. maproom/cache/catalog.py +372 -0
  66. maproom/cache/commands.py +215 -0
  67. maproom/cache/instances.py +460 -0
  68. maproom/cli.py +2084 -0
  69. maproom/cli_argv.py +329 -0
  70. maproom/cli_floors.py +89 -0
  71. maproom/cliio/__init__.py +1 -0
  72. maproom/cliio/registry.py +377 -0
  73. maproom/cliio/runner.py +489 -0
  74. maproom/consent/__init__.py +33 -0
  75. maproom/consent/gate.py +238 -0
  76. maproom/consent/policy.py +20 -0
  77. maproom/consent/prompt.py +61 -0
  78. maproom/consent/service_upload_gate.py +318 -0
  79. maproom/consent/service_upload_prompt.py +62 -0
  80. maproom/consent/stdin.py +45 -0
  81. maproom/consent/storage.py +24 -0
  82. maproom/consent/write_token.py +29 -0
  83. maproom/contracts/__init__.py +6 -0
  84. maproom/contracts/schema_diff.py +119 -0
  85. maproom/contracts/validate.py +113 -0
  86. maproom/data/__init__.py +1 -0
  87. maproom/data/clear.py +76 -0
  88. maproom/data/commands.py +14 -0
  89. maproom/doctor/__init__.py +1 -0
  90. maproom/doctor/aws_session.py +226 -0
  91. maproom/doctor/checks.py +701 -0
  92. maproom/doctor/context.py +32 -0
  93. maproom/doctor/display.py +96 -0
  94. maproom/doctor/inventory_display.py +377 -0
  95. maproom/doctor/runner.py +1467 -0
  96. maproom/errors.py +43 -0
  97. maproom/exitcodes.py +70 -0
  98. maproom/inventory/__init__.py +1 -0
  99. maproom/inventory/account_identity.py +79 -0
  100. maproom/inventory/accounts.py +155 -0
  101. maproom/inventory/command.py +961 -0
  102. maproom/inventory/messages.py +264 -0
  103. maproom/inventory/reservations_refresh.py +37 -0
  104. maproom/mock_environment/__init__.py +28 -0
  105. maproom/mock_environment/load.py +241 -0
  106. maproom/mock_environment/runner.py +387 -0
  107. maproom/output/__init__.py +1 -0
  108. maproom/output/json_envelope.py +241 -0
  109. maproom/output/redact.py +11 -0
  110. maproom/output/terminal.py +129 -0
  111. maproom/parsers.py +284 -0
  112. maproom/paths.py +105 -0
  113. maproom/plan/__init__.py +1 -0
  114. maproom/plan/accept.py +59 -0
  115. maproom/plan/analysis_context.py +78 -0
  116. maproom/plan/analyze_selection.py +279 -0
  117. maproom/plan/commands.py +586 -0
  118. maproom/plan/current.py +59 -0
  119. maproom/plan/errors.py +10 -0
  120. maproom/plan/export.py +36 -0
  121. maproom/plan/formatting.py +91 -0
  122. maproom/plan/ids.py +13 -0
  123. maproom/plan/migration_options.py +75 -0
  124. maproom/plan/model.py +265 -0
  125. maproom/plan/names.py +24 -0
  126. maproom/plan/store.py +193 -0
  127. maproom/plan/tty.py +34 -0
  128. maproom/pricing/__init__.py +5 -0
  129. maproom/pricing/prices.py +119 -0
  130. maproom/privacy/__init__.py +6 -0
  131. maproom/privacy/commands.py +159 -0
  132. maproom/privacy/delete_uploads.py +204 -0
  133. maproom/privacy/fleetfit_policy.py +125 -0
  134. maproom/privacy/fleetfit_statement.py +104 -0
  135. maproom/privacy/format.py +76 -0
  136. maproom/privacy/manifests.py +342 -0
  137. maproom/privacy/statement.py +58 -0
  138. maproom/quotas/__init__.py +21 -0
  139. maproom/quotas/aws.py +204 -0
  140. maproom/quotas/azure.py +75 -0
  141. maproom/quotas/commands.py +240 -0
  142. maproom/quotas/family_coverage.py +122 -0
  143. maproom/quotas/fetch.py +124 -0
  144. maproom/quotas/load.py +41 -0
  145. maproom/quotas/model.py +178 -0
  146. maproom/quotas/outcome_ledger.py +245 -0
  147. maproom/quotas/quota_request_sync.py +221 -0
  148. maproom/quotas/show.py +73 -0
  149. maproom/quotas/status.py +206 -0
  150. maproom/quotas/store.py +161 -0
  151. maproom/redaction.py +157 -0
  152. maproom/reference_data/__init__.py +1 -0
  153. maproom/reference_data/aws/aws_prices.csv +25562 -0
  154. maproom/reference_data/aws/capabilities.csv +1346 -0
  155. maproom/reference_data/aws/instance_types.csv +1346 -0
  156. maproom/reference_data/azure/azure_prices.csv +1 -0
  157. maproom/reference_data/azure/vm_types.csv +1 -0
  158. maproom/reference_data/benchmarks/cpu-lscpu-v2-instances.json +27 -0
  159. maproom/reference_data/benchmarks/safe-moves-v1.json +328 -0
  160. maproom/reference_data/manifest.json +174 -0
  161. maproom/reference_data/manifest.py +69 -0
  162. maproom/reservations/__init__.py +17 -0
  163. maproom/reservations/aws.py +76 -0
  164. maproom/reservations/azure.py +36 -0
  165. maproom/reservations/commands.py +149 -0
  166. maproom/reservations/load.py +41 -0
  167. maproom/reservations/model.py +316 -0
  168. maproom/reservations/show.py +64 -0
  169. maproom/reservations/status.py +181 -0
  170. maproom/reservations/store.py +391 -0
  171. maproom/resources.py +54 -0
  172. maproom/root_help.py +251 -0
  173. maproom/saving_plans/__init__.py +15 -0
  174. maproom/saving_plans/aws.py +73 -0
  175. maproom/saving_plans/commands.py +122 -0
  176. maproom/saving_plans/load.py +41 -0
  177. maproom/saving_plans/model.py +101 -0
  178. maproom/saving_plans/show.py +64 -0
  179. maproom/saving_plans/status.py +118 -0
  180. maproom/saving_plans/store.py +173 -0
  181. maproom/secret_egress_gate.py +108 -0
  182. maproom/service/install_id.py +60 -0
  183. maproom/settings/__init__.py +1 -0
  184. maproom/settings/defaults.py +73 -0
  185. maproom/settings/init.py +143 -0
  186. maproom/settings/model.py +105 -0
  187. maproom/settings/product_version_change.py +343 -0
  188. maproom/settings/product_versions.py +68 -0
  189. maproom/settings/set.py +347 -0
  190. maproom/settings/show.py +227 -0
  191. maproom/settings/write.py +273 -0
  192. maproom/snapshot_time.py +27 -0
  193. maproom-0.2.0.dist-info/METADATA +263 -0
  194. maproom-0.2.0.dist-info/RECORD +199 -0
  195. maproom-0.2.0.dist-info/WHEEL +5 -0
  196. maproom-0.2.0.dist-info/entry_points.txt +2 -0
  197. maproom-0.2.0.dist-info/licenses/LICENSE +201 -0
  198. maproom-0.2.0.dist-info/licenses/NOTICE +72 -0
  199. maproom-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,353 @@
1
+ """Shipped type lists, spec rows, and version-1 price columns."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import csv
6
+ import os
7
+ import re
8
+ from dataclasses import dataclass
9
+ from decimal import Decimal, InvalidOperation
10
+ from functools import lru_cache
11
+ from importlib import resources
12
+ from pathlib import Path
13
+
14
+ from maproom.pricing.prices import load_price_table
15
+
16
+ AWS_PRICE_REGION = "us-east-1"
17
+ AZURE_PRICE_REGION = "eastus"
18
+
19
+ # Share / fixture format still includes cloud (peer instance_specs.csv).
20
+ SPEC_COLUMNS: tuple[str, ...] = (
21
+ "cloud",
22
+ "instance_type",
23
+ "family",
24
+ "processor_vendor",
25
+ "generation",
26
+ "vcpu",
27
+ "memory_gib",
28
+ "gb_per_vcpu",
29
+ "cpu_performance_rank",
30
+ "virtualization",
31
+ "ena_required",
32
+ "nvme_boot",
33
+ "ephemeral_disk_type",
34
+ "ephemeral_disk_total_gb",
35
+ "quota_family",
36
+ "network_performance",
37
+ "max_network_interfaces",
38
+ "ipv4_addresses_per_interface",
39
+ "max_ebs_attachments",
40
+ "efa_supported",
41
+ )
42
+
43
+ TYPE_COLUMNS: tuple[str, ...] = (
44
+ "instance_type",
45
+ "family",
46
+ "processor_vendor",
47
+ "generation",
48
+ "vcpu",
49
+ "memory_gib",
50
+ "gb_per_vcpu",
51
+ "cpu_performance_rank",
52
+ "quota_family",
53
+ )
54
+
55
+ CAPABILITY_COLUMNS: tuple[str, ...] = (
56
+ "instance_type",
57
+ "virtualization",
58
+ "ena_required",
59
+ "nvme_boot",
60
+ "ephemeral_disk_type",
61
+ "ephemeral_disk_total_gb",
62
+ "network_performance",
63
+ "max_network_interfaces",
64
+ "ipv4_addresses_per_interface",
65
+ "max_ebs_attachments",
66
+ "efa_supported",
67
+ )
68
+
69
+ SAFE_MOVE_TYPE_COLUMNS: tuple[str, ...] = ("instance_type",)
70
+ AZURE_PRICE_COLUMNS: tuple[str, ...] = ("vm_size", "region", "hourly_usd")
71
+
72
+
73
+ class CatalogError(ValueError):
74
+ """A shipped table is missing a required column."""
75
+
76
+
77
+ @dataclass(frozen=True)
78
+ class SpecRow:
79
+ cloud: str
80
+ instance_type: str
81
+ family: str
82
+ processor_vendor: str
83
+ generation: int | None
84
+ vcpu: int
85
+ memory_gib: Decimal
86
+ gb_per_vcpu: Decimal | None
87
+ cpu_performance_rank: Decimal | None
88
+ virtualization: str
89
+ ena_required: bool
90
+ nvme_boot: bool
91
+ ephemeral_disk_type: str
92
+ ephemeral_disk_total_gb: Decimal
93
+ quota_family: str
94
+ network_performance: str
95
+ max_network_interfaces: int | None = None
96
+ ipv4_addresses_per_interface: int | None = None
97
+ max_ebs_attachments: int | None = None
98
+ efa_supported: bool | None = None
99
+
100
+
101
+ def _require_columns(fieldnames: list[str] | None, required: tuple[str, ...], *, table: str) -> None:
102
+ present = set(fieldnames or [])
103
+ missing = [name for name in required if name not in present]
104
+ if missing:
105
+ joined = ", ".join(missing)
106
+ raise CatalogError(f"{table} missing columns: {joined}")
107
+
108
+
109
+ def _decimal(value: str | None) -> Decimal | None:
110
+ text = (value or "").strip()
111
+ if not text:
112
+ return None
113
+ try:
114
+ return Decimal(text)
115
+ except InvalidOperation as exc:
116
+ raise CatalogError(f"not a number: {text}") from exc
117
+
118
+
119
+ def _int(value: str | None) -> int | None:
120
+ text = (value or "").strip()
121
+ if not text:
122
+ return None
123
+ return int(text)
124
+
125
+
126
+ def _bool(value: str | None) -> bool:
127
+ return (value or "").strip().lower() in {"1", "true", "yes", "y"}
128
+
129
+
130
+ def _optional_bool(value: str | None) -> bool | None:
131
+ text = (value or "").strip().lower()
132
+ if not text:
133
+ return None
134
+ if text in {"1", "true", "yes", "y"}:
135
+ return True
136
+ if text in {"0", "false", "no", "n"}:
137
+ return False
138
+ return None
139
+
140
+
141
+ _QUALITATIVE_NETWORK = {
142
+ "very low": Decimal("0.1"),
143
+ "low": Decimal("1"),
144
+ "low to moderate": Decimal("1.5"),
145
+ "moderate": Decimal("2"),
146
+ "high": Decimal("5"),
147
+ }
148
+ _GIGABIT = re.compile(r"(\d+(?:\.\d+)?)\s*gigabit", re.IGNORECASE)
149
+ _GBPS = re.compile(r"(\d+(?:\.\d+)?)\s*gbps", re.IGNORECASE)
150
+ _MBPS = re.compile(r"(\d+(?:\.\d+)?)\s*mbps", re.IGNORECASE)
151
+ _AZURE_BANDWIDTH = ("MaxNetworkBandwidthInMbps", "MaxNetworkBandwidthMbps")
152
+
153
+
154
+ def published_network_rank(text: str | None) -> Decimal | None:
155
+ """Rank a published network string. Higher is faster. Blank is unknown."""
156
+ raw = (text or "").strip().lower()
157
+ if not raw:
158
+ return None
159
+ gigabit = _GIGABIT.search(raw)
160
+ if gigabit:
161
+ return Decimal(gigabit.group(1))
162
+ gbps = _GBPS.search(raw)
163
+ if gbps:
164
+ return Decimal(gbps.group(1))
165
+ mbps = _MBPS.search(raw)
166
+ if mbps:
167
+ return Decimal(mbps.group(1)) / Decimal("1000")
168
+ return _QUALITATIVE_NETWORK.get(raw)
169
+
170
+
171
+ def harvest_published_network(document: dict) -> str:
172
+ """Copy the published network spec. AWS NetworkPerformance, or Azure Mbps."""
173
+ network = document.get("NetworkInfo")
174
+ if isinstance(network, dict):
175
+ published = str(network.get("NetworkPerformance") or "").strip()
176
+ if published:
177
+ return published
178
+ capabilities = document.get("capabilities")
179
+ if isinstance(capabilities, list):
180
+ for item in capabilities:
181
+ if not isinstance(item, dict):
182
+ continue
183
+ if str(item.get("name") or "") not in _AZURE_BANDWIDTH:
184
+ continue
185
+ value = str(item.get("value") or "").strip()
186
+ if value:
187
+ return f"{value} Mbps"
188
+ return ""
189
+
190
+
191
+ def parse_safe_move_types(text: str) -> set[str]:
192
+ reader = csv.DictReader(text.splitlines())
193
+ _require_columns(list(reader.fieldnames or []), SAFE_MOVE_TYPE_COLUMNS, table="safe-move type list")
194
+ names: set[str] = set()
195
+ for row in reader:
196
+ name = (row.get("instance_type") or "").strip()
197
+ if name:
198
+ names.add(name)
199
+ return names
200
+
201
+
202
+ def _spec_from_merged(cloud: str, row: dict[str, str]) -> SpecRow:
203
+ instance_type = (row.get("instance_type") or "").strip()
204
+ disk = (row.get("ephemeral_disk_type") or "").strip().lower() or "none"
205
+ return SpecRow(
206
+ cloud=cloud,
207
+ instance_type=instance_type,
208
+ family=(row.get("family") or "").strip().lower(),
209
+ processor_vendor=(row.get("processor_vendor") or "").strip().lower(),
210
+ generation=_int(row.get("generation")),
211
+ vcpu=int((row.get("vcpu") or "0").strip() or "0"),
212
+ memory_gib=_decimal(row.get("memory_gib")) or Decimal("0"),
213
+ gb_per_vcpu=_decimal(row.get("gb_per_vcpu")),
214
+ cpu_performance_rank=_decimal(row.get("cpu_performance_rank")),
215
+ virtualization=(row.get("virtualization") or "").strip().lower(),
216
+ ena_required=_bool(row.get("ena_required")),
217
+ nvme_boot=_bool(row.get("nvme_boot")),
218
+ ephemeral_disk_type=disk,
219
+ ephemeral_disk_total_gb=_decimal(row.get("ephemeral_disk_total_gb")) or Decimal("0"),
220
+ quota_family=(row.get("quota_family") or "").strip(),
221
+ network_performance=(row.get("network_performance") or "").strip(),
222
+ max_network_interfaces=_int(row.get("max_network_interfaces")),
223
+ ipv4_addresses_per_interface=_int(row.get("ipv4_addresses_per_interface")),
224
+ max_ebs_attachments=_int(row.get("max_ebs_attachments")),
225
+ efa_supported=_optional_bool(row.get("efa_supported")),
226
+ )
227
+
228
+
229
+ def parse_spec_rows(text: str) -> dict[tuple[str, str], SpecRow]:
230
+ """Parse the peer share format (includes a cloud column)."""
231
+ reader = csv.DictReader(text.splitlines())
232
+ _require_columns(list(reader.fieldnames or []), SPEC_COLUMNS, table="instance spec table")
233
+ rows: dict[tuple[str, str], SpecRow] = {}
234
+ for row in reader:
235
+ cloud = (row.get("cloud") or "").strip().lower()
236
+ instance_type = (row.get("instance_type") or "").strip()
237
+ if not cloud or not instance_type:
238
+ continue
239
+ rows[(cloud, instance_type)] = _spec_from_merged(cloud, row)
240
+ return rows
241
+
242
+
243
+ def parse_split_spec_rows(
244
+ *,
245
+ cloud: str,
246
+ types_text: str,
247
+ capabilities_text: str | None = None,
248
+ ) -> dict[tuple[str, str], SpecRow]:
249
+ """Join type rows with optional capability rows for one cloud folder."""
250
+ type_reader = csv.DictReader(types_text.splitlines())
251
+ _require_columns(list(type_reader.fieldnames or []), TYPE_COLUMNS, table=f"{cloud} instance types")
252
+ caps_by_type: dict[str, dict[str, str]] = {}
253
+ if capabilities_text is not None:
254
+ cap_reader = csv.DictReader(capabilities_text.splitlines())
255
+ _require_columns(
256
+ list(cap_reader.fieldnames or []),
257
+ CAPABILITY_COLUMNS,
258
+ table=f"{cloud} capabilities",
259
+ )
260
+ for row in cap_reader:
261
+ name = (row.get("instance_type") or "").strip()
262
+ if name:
263
+ caps_by_type[name] = row
264
+ rows: dict[tuple[str, str], SpecRow] = {}
265
+ for row in type_reader:
266
+ instance_type = (row.get("instance_type") or "").strip()
267
+ if not instance_type:
268
+ continue
269
+ merged = dict(row)
270
+ merged.update(caps_by_type.get(instance_type, {}))
271
+ rows[(cloud, instance_type)] = _spec_from_merged(cloud, merged)
272
+ return rows
273
+
274
+
275
+ def parse_azure_prices(text: str) -> dict[tuple[str, str], Decimal]:
276
+ reader = csv.DictReader(text.splitlines())
277
+ _require_columns(list(reader.fieldnames or []), AZURE_PRICE_COLUMNS, table="azure price table")
278
+ prices: dict[tuple[str, str], Decimal] = {}
279
+ for row in reader:
280
+ size = (row.get("vm_size") or "").strip()
281
+ region = (row.get("region") or "").strip().lower()
282
+ hourly = _decimal(row.get("hourly_usd"))
283
+ if size and region and hourly is not None:
284
+ prices[(size, region)] = hourly
285
+ return prices
286
+
287
+
288
+ def _read_reference(*parts: str) -> str:
289
+ return resources.files("maproom").joinpath("reference_data", *parts).read_text(encoding="utf-8")
290
+
291
+
292
+ @lru_cache(maxsize=1)
293
+ def load_safe_move_types(cloud: str) -> frozenset[str]:
294
+ """Empty set: the closed type-list CSVs were removed; analyze uses safe-moves-v1.json."""
295
+ _ = cloud
296
+ return frozenset()
297
+
298
+
299
+ @lru_cache(maxsize=1)
300
+ def load_spec_rows() -> dict[tuple[str, str], SpecRow]:
301
+ """Read shipped split tables, or ``MAPROOM_SPEC_FIXTURE`` when it is set."""
302
+
303
+ override = os.environ.get("MAPROOM_SPEC_FIXTURE", "").strip()
304
+ if override:
305
+ return parse_spec_rows(Path(override).read_text(encoding="utf-8"))
306
+ rows: dict[tuple[str, str], SpecRow] = {}
307
+ rows.update(
308
+ parse_split_spec_rows(
309
+ cloud="aws",
310
+ types_text=_read_reference("aws", "instance_types.csv"),
311
+ capabilities_text=_read_reference("aws", "capabilities.csv"),
312
+ )
313
+ )
314
+ rows.update(
315
+ parse_split_spec_rows(
316
+ cloud="azure",
317
+ types_text=_read_reference("azure", "vm_types.csv"),
318
+ capabilities_text=None,
319
+ )
320
+ )
321
+ return rows
322
+
323
+
324
+ @lru_cache(maxsize=1)
325
+ def load_us_east_1_hourly() -> dict[str, Decimal]:
326
+ return load_price_table().region_hourly(AWS_PRICE_REGION)
327
+
328
+
329
+ @lru_cache(maxsize=1)
330
+ def load_azure_eastus_hourly() -> dict[str, Decimal]:
331
+ parsed = parse_azure_prices(_read_reference("azure", "azure_prices.csv"))
332
+ return {size: hourly for (size, region), hourly in parsed.items() if region == AZURE_PRICE_REGION}
333
+
334
+
335
+ def price_for(cloud: str, instance_type: str) -> Decimal | None:
336
+ if cloud.strip().lower() == "azure":
337
+ return load_azure_eastus_hourly().get(instance_type)
338
+ return load_us_east_1_hourly().get(instance_type)
339
+
340
+
341
+ def spec_architecture(row: SpecRow) -> str | None:
342
+ """Architecture string for a shipped spec row."""
343
+ vendor = (row.processor_vendor or "").strip().lower()
344
+ if vendor in ("arm", "aws-graviton", "graviton"):
345
+ return "arm64"
346
+ if vendor in ("intel", "amd", "x86"):
347
+ return "x86_64"
348
+ return None
349
+
350
+
351
+ def is_burstable_family(family: str) -> bool:
352
+ base = (family or "").strip().lower()
353
+ return base.startswith(("t2", "t3", "t4"))