Skip to content

Commit e492d56

Browse files
committed
Make unit test more explicit that we ignore the size of the instance
1 parent 454daf7 commit e492d56

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

cli/src/pcluster/templates/queues_stack.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -369,37 +369,38 @@ def add_network_interfaces(
369369
):
370370
"""Generate launch template network interfaces list."""
371371
is_gb200 = compute_resource.instance_types[0].split(".")[0] == P6E_GB200
372-
interface = "efa" if compute_resource.efa and compute_resource.efa.enabled and not is_gb200 else None
372+
efa_enabled = compute_resource.efa and compute_resource.efa.enabled
373+
interface_type = "efa" if efa_enabled and not is_gb200 else None
373374

374375
compute_lt_nw_interfaces = [
375376
ec2.CfnLaunchTemplate.NetworkInterfaceProperty(
376377
device_index=0,
377378
network_card_index=0,
378379
associate_public_ip_address=queue.networking.assign_public_ip,
379-
interface_type=interface,
380+
interface_type=interface_type,
380381
groups=queue_lt_security_groups,
381382
subnet_id=(queue.networking.subnet_ids[0] if isinstance(compute_resource, SlurmComputeResource) else None),
382383
)
383384
]
384385

385386
for network_card in compute_resource.network_cards_list[1:]:
386-
efa_enabled = True if compute_resource.efa and compute_resource.efa.enabled else False
387387
even = network_card.network_card_index() % 2 == 0
388-
# if efa is disabled, and we have a gb200 instance we skip configuring odd numbered indexes
388+
# if efa is disabled, and we have a gb200 instance we skip configuring odd numbered indexes because they only
389+
# support efa-only interface type
389390
if is_gb200 and not efa_enabled and not even:
390391
continue
391392

392-
interface = "efa" if compute_resource.efa and compute_resource.efa.enabled else None
393+
interface_type = "efa" if efa_enabled else None
393394
# if efa is enabled with a gb200 instance, even indexes are configured as efa and the odd as efa-only
394395
if is_gb200 and efa_enabled:
395-
interface = "efa" if even else "efa-only"
396+
interface_type = "efa" if even else "efa-only"
396397

397398
compute_lt_nw_interfaces.append(
398399
ec2.CfnLaunchTemplate.NetworkInterfaceProperty(
399400
device_index=0 if network_card.maximum_network_interfaces() == 1 else 1,
400401
network_card_index=network_card.network_card_index(),
401402
associate_public_ip_address=False,
402-
interface_type=interface,
403+
interface_type=interface_type,
403404
groups=queue_lt_security_groups,
404405
subnet_id=(
405406
queue.networking.subnet_ids[0] if isinstance(compute_resource, SlurmComputeResource) else None

cli/tests/pcluster/templates/test_queues_stack.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def maximum_network_interfaces(self):
171171
[
172172
(
173173
True,
174-
"p6e-gb200.36xlarge",
174+
"p6e-gb200.WHATEVER_SIZE",
175175
[NetworkCard(0), NetworkCard(1), NetworkCard(2, 2), NetworkCard(3), NetworkCard(4, 2)],
176176
[
177177
{"network_card_index": 0, "interface_type": None, "device_index": 0},
@@ -183,7 +183,7 @@ def maximum_network_interfaces(self):
183183
),
184184
(
185185
False,
186-
"p6e-gb200.36xlarge",
186+
"p6e-gb200.WHATEVER_SIZE",
187187
[NetworkCard(0), NetworkCard(1), NetworkCard(2, 2), NetworkCard(3), NetworkCard(4, 2)],
188188
[
189189
{"network_card_index": 0, "interface_type": None, "device_index": 0},
@@ -193,14 +193,24 @@ def maximum_network_interfaces(self):
193193
),
194194
(
195195
True,
196-
"c6in.32xlarge",
196+
"NOTp6e-gb200.WHATEVER_SIZE",
197197
[NetworkCard(0), NetworkCard(1, 2), NetworkCard(2, 2)],
198198
[
199199
{"network_card_index": 0, "interface_type": "efa", "device_index": 0},
200200
{"network_card_index": 1, "interface_type": "efa", "device_index": 1},
201201
{"network_card_index": 2, "interface_type": "efa", "device_index": 1},
202202
],
203203
),
204+
(
205+
False,
206+
"NOTp6e-gb200.WHATEVER_SIZE",
207+
[NetworkCard(0), NetworkCard(1, 2), NetworkCard(2, 2)],
208+
[
209+
{"network_card_index": 0, "interface_type": None, "device_index": 0},
210+
{"network_card_index": 1, "interface_type": None, "device_index": 1},
211+
{"network_card_index": 2, "interface_type": None, "device_index": 1},
212+
],
213+
),
204214
],
205215
)
206216
def test_add_compute_resource_launch_template(

0 commit comments

Comments
 (0)