Skip to content

Commit b6ba266

Browse files
hanwen-clusterHimani Anil Deshpande
authored andcommitted
[integ-tests] Find capacity blocks by OS
1 parent 502494f commit b6ba266

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

tests/integration-tests/tests/common/utils.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,15 +554,22 @@ def terminate_nodes_manually(instance_ids, region):
554554
logging.info("Terminated nodes: {}".format(instance_ids))
555555

556556

557-
def get_capacity_reservation_id(instance_type, region, count):
557+
def get_capacity_reservation_id(instance_type, region, count, os):
558+
os_platform = "Linux/UNIX"
559+
if "rhel" in os.lower():
560+
os_platform = "Red Hat Enterprise Linux"
558561
ec2_client = boto3.client("ec2", region_name=region)
559562
paginator = ec2_client.get_paginator("describe_capacity_reservations")
560563
# List to store matching reservation IDs
561564
reservations_ids = []
562565
# Paginate through the results
563566
for page in paginator.paginate():
564567
for reservation in page.get("CapacityReservations", []):
565-
if instance_type == reservation.get("InstanceType") and reservation.get("AvailableInstanceCount") >= count:
568+
if (
569+
instance_type == reservation.get("InstanceType")
570+
and os_platform == reservation.get("InstancePlatform")
571+
and reservation.get("AvailableInstanceCount") >= count
572+
):
566573
reservations_ids.append(
567574
{
568575
"CapacityReservationId": reservation["CapacityReservationId"],

tests/integration-tests/tests/efa/test_efa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_efa(
5858
max_queue_size = 2
5959
p6_b200_capacity_reservation_id = None
6060
if instance == "p6-b200.48xlarge":
61-
capacity_reservations_ids = get_capacity_reservation_id(instance, region, max_queue_size)
61+
capacity_reservations_ids = get_capacity_reservation_id(instance, region, max_queue_size, os)
6262
if capacity_reservations_ids:
6363
p6_b200_capacity_reservation_id = capacity_reservations_ids[0].get("CapacityReservationId")
6464
else:

tests/integration-tests/tests/ultraserver/test_gb200.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ def assert_topology_plugin_completely_disabled(cluster: Cluster):
346346

347347

348348
@pytest.mark.usefixtures("serial_execution_by_instance")
349-
@pytest.mark.usefixtures("os")
350349
def test_gb200(
351350
pcluster_config_reader,
352351
file_reader,
@@ -356,6 +355,7 @@ def test_gb200(
356355
region,
357356
instance,
358357
scheduler,
358+
os,
359359
scheduler_commands_factory,
360360
):
361361
"""
@@ -391,7 +391,7 @@ def test_gb200(
391391
capacity_reservation_id = None
392392
max_queue_size = 2
393393
if instance == "p6e-gb200.36xlarge":
394-
ultraserver_reservations_ids = get_capacity_reservation_id(instance, region, max_queue_size)
394+
ultraserver_reservations_ids = get_capacity_reservation_id(instance, region, max_queue_size, os)
395395
if ultraserver_reservations_ids:
396396
capacity_reservation_id = ultraserver_reservations_ids[0].get("CapacityReservationId")
397397
else:

0 commit comments

Comments
 (0)