|
13 | 13 | import subprocess |
14 | 14 | from pathlib import Path |
15 | 15 |
|
16 | | -DEFAULT_INSTANCES = { |
17 | | - "c5n.metal": "x86_64", # Intel Skylake |
18 | | - "m5n.metal": "x86_64", # Intel Cascade Lake |
19 | | - "m6i.metal": "x86_64", # Intel Icelake |
20 | | - "m6a.metal": "x86_64", # AMD Milan |
21 | | - "m6g.metal": "aarch64", # Graviton2 |
22 | | - "m7g.metal": "aarch64", # Graviton3 |
23 | | -} |
| 16 | +DEFAULT_INSTANCES = [ |
| 17 | + "c5n.metal", # Intel Skylake |
| 18 | + "m5n.metal", # Intel Cascade Lake |
| 19 | + "m6i.metal", # Intel Icelake |
| 20 | + "m6a.metal", # AMD Milan |
| 21 | + "m6g.metal", # Graviton2 |
| 22 | + "m7g.metal", # Graviton3 |
| 23 | +] |
24 | 24 |
|
25 | 25 | DEFAULT_PLATFORMS = [ |
26 | 26 | ("al2", "linux_5.10"), |
27 | 27 | ("al2023", "linux_6.1"), |
28 | 28 | ] |
29 | 29 |
|
30 | 30 |
|
| 31 | +def get_arch_for_instance(instance): |
| 32 | + """Return instance architecture""" |
| 33 | + return "x86_64" if instance[2] != "g" else "aarch64" |
| 34 | + |
| 35 | + |
31 | 36 | def overlay_dict(base: dict, update: dict): |
32 | 37 | """Overlay a dict over a base one""" |
33 | 38 | base = base.copy() |
@@ -145,7 +150,7 @@ def __call__(self, parser, namespace, value, option_string=None): |
145 | 150 | "--instances", |
146 | 151 | required=False, |
147 | 152 | nargs="+", |
148 | | - default=DEFAULT_INSTANCES.keys(), |
| 153 | + default=DEFAULT_INSTANCES, |
149 | 154 | ) |
150 | 155 | COMMON_PARSER.add_argument( |
151 | 156 | "--platforms", |
@@ -288,7 +293,7 @@ def _adapt_group(self, group): |
288 | 293 | step["command"] = prepend + step["command"] |
289 | 294 | if self.shared_build is not None: |
290 | 295 | step["depends_on"] = self.build_key( |
291 | | - DEFAULT_INSTANCES[step["agents"]["instance"]] |
| 296 | + get_arch_for_instance(step["agents"]["instance"]) |
292 | 297 | ) |
293 | 298 | return group |
294 | 299 |
|
@@ -323,7 +328,7 @@ def build_group_per_arch(self, label, *args, **kwargs): |
323 | 328 | if set_key: |
324 | 329 | for step in grp["steps"]: |
325 | 330 | step["key"] = self.build_key( |
326 | | - DEFAULT_INSTANCES[step["agents"]["instance"]] |
| 331 | + get_arch_for_instance(step["agents"]["instance"]) |
327 | 332 | ) |
328 | 333 | return self.add_step(grp, depends_on_build=depends_on_build) |
329 | 334 |
|
|
0 commit comments