Skip to content

[Subnet Prioritization] Add EnableSingleAvailabilityZone to Fleet Config #2973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This file is used to list changes made in each version of the AWS ParallelCluste

**CHANGES**
- Ubuntu 20.04 is no longer supported.
- Add SingleAvailabilityZone parameter to fleet_config.json

3.13.1
------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ def generate_fleet_config_file(output_file: str, input_file: str):
queue_capacity_reservation=queue_capacity_reservation,
queue_capacity_type=queue_capacity_type,
queue_subnets=queue_config["Networking"]["SubnetIds"],
queue_single_availability_zone=queue_config.get("Networking", {}).get(
"EnableSingleAvailabilityZone", None
),
)
fleet_config[queue_name][compute_resource_name] = config_for_fleet

Expand All @@ -125,6 +128,7 @@ def _generate_compute_resource_fleet_config(
queue_capacity_reservation: str,
queue_capacity_type: str,
queue_subnets: List,
queue_single_availability_zone: bool,
):
"""
Generate compute resource config to add in the fleet-config.json, overriding values from the queue.
Expand Down Expand Up @@ -156,7 +160,10 @@ def _generate_compute_resource_fleet_config(
{
"Api": "create-fleet",
"Instances": copy.deepcopy(compute_resource_config["Instances"]),
"Networking": {"SubnetIds": queue_subnets},
"Networking": {
"SubnetIds": queue_subnets,
"SingleAvailabilityZone": queue_single_availability_zone,
},
}
)
allocation_strategy = compute_resource_config.get("AllocationStrategy", queue_allocation_strategy)
Expand Down
48 changes: 41 additions & 7 deletions test/unit/slurm/test_fleet_config_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@
CriticalError,
"Unable to find key 'Name' in the configuration file. Queue: q1",
),
(
{
"Scheduling": {
"SlurmQueues": [
{
"Name": "q1",
"CapacityType": "SPOT",
"ComputeResources": [{"Instances": []}],
"Networking": {"SubnetIds": ["123"], "EnableSingleAvailabilityZone": None},
}
]
}
},
CriticalError,
"Unable to find key 'Name' in the configuration file. Queue: q1",
),
(
{
"Scheduling": {
Expand All @@ -70,7 +86,7 @@
"Name": "q1",
"CapacityType": "ONDEMAND",
"ComputeResources": [{"Name": "cr1", "Instances": []}],
"Networking": {"SubnetIds": ["123"]},
"Networking": {"SubnetIds": ["123"], "EnableSingleAvailabilityZone": None},
}
]
}
Expand All @@ -89,7 +105,7 @@
{"Name": "cr1", "Instances": [{"InstanceType": "test"}]},
{"Name": "cr2", "InstanceType": "test"},
],
"Networking": {"SubnetIds": ["123"]},
"Networking": {"SubnetIds": ["123"], "EnableSingleAvailabilityZone": None},
}
]
}
Expand All @@ -108,7 +124,7 @@
{"Name": "cr1", "Instances": [{"InstanceType": "test"}, {"InstanceType": "test-2"}]},
{"Name": "cr2", "InstanceType": "test"},
],
"Networking": {"SubnetIds": ["123", "456", "789"]},
"Networking": {"SubnetIds": ["123", "456", "789"], "EnableSingleAvailabilityZone": None},
}
]
}
Expand All @@ -131,7 +147,7 @@
},
{"Name": "cr2", "InstanceType": "test", "SpotPrice": "10"},
],
"Networking": {"SubnetIds": ["123", "456", "789"]},
"Networking": {"SubnetIds": ["123", "456", "789"], "EnableSingleAvailabilityZone": None},
}
]
}
Expand All @@ -147,7 +163,7 @@
"Name": "q1",
"CapacityType": "SPOT",
"ComputeResources": [{"Name": "cr1", "Instances": [{"InstanceType": "test"}]}],
"Networking": {"SubnetIds": ["123"]},
"Networking": {"SubnetIds": ["123"], "EnableSingleAvailabilityZone": None},
}
]
}
Expand All @@ -165,7 +181,7 @@
"ComputeResources": [
{"Name": "cr1", "Instances": [{"InstanceType": "test"}], "SpotPrice": 10}
],
"Networking": {"SubnetIds": ["123"]},
"Networking": {"SubnetIds": ["123"], "EnableSingleAvailabilityZone": None},
}
]
}
Expand Down Expand Up @@ -208,6 +224,24 @@
CriticalError,
"Unable to find key 'SubnetIds' in the configuration file. Queue: q1",
),
(
{
"Scheduling": {
"SlurmQueues": [
{
"Name": "q1",
"CapacityType": "SPOT",
"ComputeResources": [
{"Name": "cr1", "Instances": [{"InstanceType": "test"}], "SpotPrice": 10}
],
"Networking": {"SubnetIds": ["123"]},
}
]
}
},
None,
None,
),
(
{
"Scheduling": {
Expand All @@ -231,7 +265,7 @@
},
},
],
"Networking": {"SubnetIds": ["123"]},
"Networking": {"SubnetIds": ["123"], "EnableSingleAvailabilityZone": None},
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"Networking": {
"SubnetIds": [
"subnet-0230367ab0e5123a4"
]
],
"SingleAvailabilityZone": true
},
"AllocationStrategy": "lowest-price"
}
Expand Down Expand Up @@ -57,7 +58,8 @@
"SubnetIds": [
"subnet-0230367ab0e5123a4",
"subnet-0b903123096649662"
]
],
"SingleAvailabilityZone": false
},
"AllocationStrategy": "lowest-price"
}
Expand All @@ -84,7 +86,8 @@
"Networking": {
"SubnetIds": [
"subnet-0230367ab0e5123a4"
]
],
"SingleAvailabilityZone": null
},
"AllocationStrategy": "capacity-optimized",
"MaxPrice": 10
Expand All @@ -100,7 +103,8 @@
"Networking": {
"SubnetIds": [
"subnet-0230367ab0e5123a4"
]
],
"SingleAvailabilityZone": null
},
"AllocationStrategy": "capacity-optimized"
}
Expand Down Expand Up @@ -131,7 +135,8 @@
"Networking": {
"SubnetIds": [
"subnet-0230367ab0e5123a4"
]
],
"SingleAvailabilityZone": null
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Scheduling:
SecurityGroups: null
SubnetIds:
- subnet-0230367ab0e5123a4
EnableSingleAvailabilityZone: true
# queue ondemand without capacity reservations and with multiple subnets
- AllocationStrategy: lowest-price
CapacityReservationTarget: null
Expand Down Expand Up @@ -121,6 +122,7 @@ Scheduling:
SubnetIds:
- subnet-0230367ab0e5123a4
- subnet-0b903123096649662
EnableSingleAvailabilityZone: false
# queue spot
- AllocationStrategy: capacity-optimized
CapacityReservationTarget: null
Expand Down Expand Up @@ -191,6 +193,7 @@ Scheduling:
SecurityGroups: null
SubnetIds:
- subnet-0230367ab0e5123a4
EnableSingleAvailabilityZone: null
# queue for capacity-block
- CapacityReservationTarget:
CapacityReservationId: cr-987654
Expand Down
Loading