Skip to content

Commit e5a10ca

Browse files
committed
Added tests for custom features
1 parent ff9f15c commit e5a10ca

File tree

6 files changed

+143
-0
lines changed

6 files changed

+143
-0
lines changed

test/unit/slurm/test_slurm_config_generator.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,32 @@ def test_generate_slurm_config_with_custom_settings(mocker, test_datadir, tmpdir
224224
_assert_files_are_equal(tmpdir / file_name, test_datadir / "expected_outputs" / output_file_name)
225225

226226

227+
def test_generate_slurm_config_with_custom_features(mocker, test_datadir, tmpdir):
228+
_mock_head_node_config(mocker)
229+
230+
input_file = os.path.join(test_datadir, "sample_input.yaml")
231+
instance_types_data = os.path.join(test_datadir, "sample_instance_types_data.json")
232+
233+
template_directory = get_template_folder()
234+
generate_slurm_config_files(
235+
tmpdir,
236+
template_directory,
237+
input_file,
238+
instance_types_data,
239+
dryrun=False,
240+
no_gpu=False,
241+
compute_node_bootstrap_timeout=1600,
242+
realmemory_to_ec2memory_ratio=0.95,
243+
slurmdbd_user="slurm",
244+
cluster_name="test-cluster",
245+
)
246+
247+
for queue in ["efa", "gpu", "multiple_spot"]:
248+
file_name = f"pcluster/slurm_parallelcluster_{queue}_partition.conf"
249+
output_file_name = f"pcluster/slurm_parallelcluster_{queue}_partition.conf"
250+
_assert_files_are_equal(tmpdir / file_name, test_datadir / "expected_outputs" / output_file_name)
251+
252+
227253
def test_generate_slurm_config_with_job_exc_alloc(mocker, test_datadir, tmpdir):
228254
_mock_head_node_config(mocker)
229255

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file is automatically generated by pcluster
2+
3+
NodeName=efa-st-efa-c5n-[1-1] CPUs=36 RealMemory=186777 State=CLOUD Feature=c5n.18xlarge,efa,efa-c5n,static Weight=1 CustomEfaComputeParam=unique_efa_compute_value OtherEfaComputeParam=second_efa_compute_value
4+
NodeName=efa-dy-efa-c5n-[1-4] CPUs=36 RealMemory=186777 State=CLOUD Feature=c5n.18xlarge,dynamic,efa,efa-c5n Weight=1000 CustomEfaComputeParam=unique_efa_compute_value OtherEfaComputeParam=second_efa_compute_value
5+
6+
NodeSet=efa_nodes Nodes=efa-st-efa-c5n-[1-1],efa-dy-efa-c5n-[1-4]
7+
PartitionName=efa Nodes=efa_nodes MaxTime=INFINITE State=UP CustomEfaParam=unique_efa_value OtherEfaParam=second_efa_value
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file is automatically generated by pcluster
2+
3+
NodeName=gpu-st-gpu-g38xlarge-[1-1] CPUs=32 RealMemory=237363 State=CLOUD Feature=g3.8xlarge,gpu,gpu-g38xlarge,myfeat-gpu,static Weight=1 Gres=gpu:m60:2 CustomNvidiaParam=nvidia_setting CustomAmdParam=amd_setting CustomIntelParam=intel_setting
4+
NodeName=gpu-dy-gpu-g38xlarge-[1-4] CPUs=32 RealMemory=237363 State=CLOUD Feature=dynamic,g3.8xlarge,gpu,gpu-g38xlarge,myfeat-gpu Weight=1000 Gres=gpu:m60:2 CustomNvidiaParam=nvidia_setting CustomAmdParam=amd_setting CustomIntelParam=intel_setting
5+
NodeName=gpu-dy-gpu-p3dn24xlarge-[1-10] CPUs=96 RealMemory=747110 State=CLOUD Feature=dynamic,gpu,gpu-p3dn24xlarge,p3dn.24xlarge Weight=1000 Gres=gpu:v100:8
6+
7+
NodeSet=gpu_nodes Nodes=gpu-st-gpu-g38xlarge-[1-1],gpu-dy-gpu-g38xlarge-[1-4],gpu-dy-gpu-p3dn24xlarge-[1-10]
8+
PartitionName=gpu Nodes=gpu_nodes MaxTime=INFINITE State=UP CustomParam=unique_value OtherParam=second_value TreeAsThird=3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file is automatically generated by pcluster
2+
3+
NodeName=multiple_spot-st-multiplespot-1-[1-5] CPUs=4 RealMemory=7296 State=CLOUD Feature=c4.xlarge,multiplespot-1,myfeat1,qwerty2,static Weight=1 CustomComputeParam=unique_compute_value OtherComputeParam=second_compute_value
4+
NodeName=multiple_spot-dy-multiplespot-1-[1-5] CPUs=4 RealMemory=7296 State=CLOUD Feature=c4.xlarge,dynamic,multiplespot-1,myfeat1,qwerty2 Weight=1000 CustomComputeParam=unique_compute_value OtherComputeParam=second_compute_value
5+
NodeName=multiple_spot-st-multiplespot-2-[1-5] CPUs=4 RealMemory=15564 State=CLOUD Feature=c5.2xlarge,multiplespot-2,static Weight=1
6+
7+
NodeSet=multiple_spot_nodes Nodes=multiple_spot-st-multiplespot-1-[1-5],multiple_spot-dy-multiplespot-1-[1-5],multiple_spot-st-multiplespot-2-[1-5]
8+
PartitionName=multiple_spot Nodes=multiple_spot_nodes MaxTime=INFINITE State=UP Default=YES CustomQueueParam=unique_queue_value OtherQueueParam=second_queue_value
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Scheduling:
2+
SlurmQueues:
3+
- Name: multiple_spot
4+
CustomSlurmSettings:
5+
CustomQueueParam: unique_queue_value
6+
OtherQueueParam: second_queue_value
7+
CapacityType: SPOT
8+
ComputeResources:
9+
- Name: multiplespot-1
10+
DisableSimultaneousMultithreading: false
11+
Efa:
12+
Enabled: false
13+
GdrSupport: false
14+
CustomSlurmSettings:
15+
CustomComputeParam: unique_compute_value
16+
OtherComputeParam: second_compute_value
17+
Feature: myfeat1,qwerty2
18+
InstanceType: c4.xlarge
19+
MaxCount: 10
20+
MinCount: 5
21+
StaticNodePriority: 1
22+
DynamicNodePriority: 1000
23+
- DisableSimultaneousMultithreading: true
24+
Efa:
25+
Enabled: false
26+
GdrSupport: false
27+
InstanceType: c5.2xlarge
28+
MaxCount: 5
29+
MinCount: 5
30+
Name: multiplespot-2
31+
StaticNodePriority: 1
32+
DynamicNodePriority: 1000
33+
- Name: efa
34+
CapacityType: ONDEMAND
35+
CustomSlurmSettings:
36+
CustomEfaParam: unique_efa_value
37+
OtherEfaParam: second_efa_value
38+
ComputeResources:
39+
- Name: efa-c5n
40+
CustomSlurmSettings:
41+
CustomEfaComputeParam: unique_efa_compute_value
42+
OtherEfaComputeParam: second_efa_compute_value
43+
DisableSimultaneousMultithreading: true
44+
Efa:
45+
Enabled: true
46+
GdrSupport: false
47+
InstanceType: c5n.18xlarge
48+
MaxCount: 5
49+
MinCount: 1
50+
StaticNodePriority: 1
51+
DynamicNodePriority: 1000
52+
ComputeSettings: null
53+
CustomActions: null
54+
- Name: gpu
55+
CapacityType: ONDEMAND
56+
CustomSlurmSettings:
57+
CustomParam: unique_value
58+
OtherParam: second_value
59+
TreeAsThird: 3
60+
ComputeResources:
61+
- Name: gpu-g38xlarge
62+
DisableSimultaneousMultithreading: false
63+
Efa:
64+
Enabled: false
65+
GdrSupport: false
66+
CustomSlurmSettings:
67+
CustomNvidiaParam: nvidia_setting
68+
CustomAmdParam: amd_setting
69+
CustomIntelParam: intel_setting
70+
Feature: myfeat-gpu
71+
InstanceType: g3.8xlarge
72+
MaxCount: 5
73+
MinCount: 1
74+
StaticNodePriority: 1
75+
DynamicNodePriority: 1000
76+
- Name: gpu-p3dn24xlarge
77+
DisableSimultaneousMultithreading: false
78+
Efa:
79+
Enabled: false
80+
GdrSupport: false
81+
InstanceType: p3dn.24xlarge
82+
MaxCount: 10
83+
MinCount: 0
84+
StaticNodePriority: 1
85+
DynamicNodePriority: 1000
86+
ComputeSettings: null
87+
CustomActions: null
88+
Scheduler: slurm
89+
SlurmSettings:
90+
ScaledownIdletime: 10
91+
EnableMemoryBasedScheduling: false
92+
Database: null
93+
ExternalSlurmdbd: null
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"t3.micro": {"InstanceType": "t3.micro", "CurrentGeneration": true, "FreeTierEligible": false, "SupportedUsageClasses": ["on-demand", "spot"], "SupportedRootDeviceTypes": ["ebs"], "SupportedVirtualizationTypes": ["hvm"], "BareMetal": false, "Hypervisor": "nitro", "ProcessorInfo": {"SupportedArchitectures": ["x86_64"], "SustainedClockSpeedInGhz": 2.5}, "VCpuInfo": {"DefaultVCpus": 2, "DefaultCores": 1, "DefaultThreadsPerCore": 2, "ValidCores": [1], "ValidThreadsPerCore": [1, 2]}, "MemoryInfo": {"SizeInMiB": 1024}, "InstanceStorageSupported": false, "EbsInfo": {"EbsOptimizedSupport": "default", "EncryptionSupport": "supported", "EbsOptimizedInfo": {"BaselineBandwidthInMbps": 87, "BaselineThroughputInMBps": 10.875, "BaselineIops": 500, "MaximumBandwidthInMbps": 2085, "MaximumThroughputInMBps": 260.625, "MaximumIops": 11800}, "NvmeSupport": "unsupported"}, "NetworkInfo": {"NetworkPerformance": "Up to 5 Gigabit", "MaximumNetworkInterfaces": 2, "MaximumNetworkCards": 1, "DefaultNetworkCardIndex": 0, "NetworkCards": [{"NetworkCardIndex": 0, "NetworkPerformance": "Up to 5 Gigabit", "MaximumNetworkInterfaces": 2}], "Ipv4AddressesPerInterface": 2, "Ipv6AddressesPerInterface": 2, "Ipv6Supported": true, "EnaSupport": "required", "EfaSupported": false}, "PlacementGroupInfo": {"SupportedStrategies": ["partition", "spread"]}, "HibernationSupported": true, "BurstablePerformanceSupported": true, "DedicatedHostsSupported": false, "AutoRecoverySupported": true}, "c4.xlarge": {"InstanceType": "c4.xlarge", "CurrentGeneration": true, "FreeTierEligible": false, "SupportedUsageClasses": ["spot", "ondemand"], "SupportedRootDeviceTypes": ["ebs"], "SupportedVirtualizationTypes": ["hvm"], "BareMetal": false, "Hypervisor": "xen", "ProcessorInfo": {"SupportedArchitectures": ["x86_64"], "SustainedClockSpeedInGhz": 2.9}, "VCpuInfo": {"DefaultVCpus": 4, "DefaultCores": 2, "DefaultThreadsPerCore": 2, "ValidCores": [1, 2], "ValidThreadsPerCore": [1, 2]}, "MemoryInfo": {"SizeInMiB": 7680}, "InstanceStorageSupported": false, "EbsInfo": {"EbsOptimizedSupport": "default", "EncryptionSupport": "supported", "EbsOptimizedInfo": {"BaselineBandwidthInMbps": 750, "BaselineThroughputInMBps": 93.75, "BaselineIops": 6000, "MaximumBandwidthInMbps": 750, "MaximumThroughputInMBps": 93.75, "MaximumIops": 6000}, "NvmeSupport": "unsupported"}, "NetworkInfo": {"NetworkPerformance": "High", "MaximumNetworkInterfaces": 4, "MaximumNetworkCards": 1, "DefaultNetworkCardIndex": 0, "NetworkCards": [{"NetworkCardIndex": 0, "NetworkPerformance": "High", "MaximumNetworkInterfaces": 4}], "Ipv4AddressesPerInterface": 15, "Ipv6AddressesPerInterface": 15, "Ipv6Supported": true, "EnaSupport": "unsupported", "EfaSupported": false}, "PlacementGroupInfo": {"SupportedStrategies": ["cluster", "partition", "spread"]}, "HibernationSupported": true, "BurstablePerformanceSupported": false, "DedicatedHostsSupported": true, "AutoRecoverySupported": true}, "c5.2xlarge": {"InstanceType": "c5.2xlarge", "CurrentGeneration": true, "FreeTierEligible": false, "SupportedUsageClasses": ["spot", "ondemand"], "SupportedRootDeviceTypes": ["ebs"], "SupportedVirtualizationTypes": ["hvm"], "BareMetal": false, "Hypervisor": "nitro", "ProcessorInfo": {"SupportedArchitectures": ["x86_64"], "SustainedClockSpeedInGhz": 3.4}, "VCpuInfo": {"DefaultVCpus": 8, "DefaultCores": 4, "DefaultThreadsPerCore": 2, "ValidCores": [2, 4], "ValidThreadsPerCore": [1, 2]}, "MemoryInfo": {"SizeInMiB": 16384}, "InstanceStorageSupported": false, "EbsInfo": {"EbsOptimizedSupport": "default", "EncryptionSupport": "supported", "EbsOptimizedInfo": {"BaselineBandwidthInMbps": 2300, "BaselineThroughputInMBps": 287.5, "BaselineIops": 10000, "MaximumBandwidthInMbps": 4750, "MaximumThroughputInMBps": 593.75, "MaximumIops": 20000}, "NvmeSupport": "unsupported"}, "NetworkInfo": {"NetworkPerformance": "Up to 10 Gigabit", "MaximumNetworkInterfaces": 4, "MaximumNetworkCards": 1, "DefaultNetworkCardIndex": 0, "NetworkCards": [{"NetworkCardIndex": 0, "NetworkPerformance": "Up to 10 Gigabit", "MaximumNetworkInterfaces": 4}], "Ipv4AddressesPerInterface": 15, "Ipv6AddressesPerInterface": 15, "Ipv6Supported": true, "EnaSupport": "required", "EfaSupported": false}, "PlacementGroupInfo": {"SupportedStrategies": ["cluster", "partition", "spread"]}, "HibernationSupported": true, "BurstablePerformanceSupported": false, "DedicatedHostsSupported": true, "AutoRecoverySupported": true}, "c5n.18xlarge": {"InstanceType": "c5n.18xlarge", "CurrentGeneration": true, "FreeTierEligible": false, "SupportedUsageClasses": ["spot", "ondemand"], "SupportedRootDeviceTypes": ["ebs"], "SupportedVirtualizationTypes": ["hvm"], "BareMetal": false, "Hypervisor": "nitro", "ProcessorInfo": {"SupportedArchitectures": ["x86_64"], "SustainedClockSpeedInGhz": 3.4}, "VCpuInfo": {"DefaultVCpus": 72, "DefaultCores": 36, "DefaultThreadsPerCore": 2, "ValidCores": [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36], "ValidThreadsPerCore": [1, 2]}, "MemoryInfo": {"SizeInMiB": 196608}, "InstanceStorageSupported": false, "EbsInfo": {"EbsOptimizedSupport": "default", "EncryptionSupport": "supported", "EbsOptimizedInfo": {"BaselineBandwidthInMbps": 19000, "BaselineThroughputInMBps": 2375.0, "BaselineIops": 80000, "MaximumBandwidthInMbps": 19000, "MaximumThroughputInMBps": 2375.0, "MaximumIops": 80000}, "NvmeSupport": "unsupported"}, "NetworkInfo": {"NetworkPerformance": "100 Gigabit", "MaximumNetworkInterfaces": 15, "MaximumNetworkCards": 1, "DefaultNetworkCardIndex": 0, "NetworkCards": [{"NetworkCardIndex": 0, "NetworkPerformance": "100 Gigabit", "MaximumNetworkInterfaces": 15}], "Ipv4AddressesPerInterface": 50, "Ipv6AddressesPerInterface": 50, "Ipv6Supported": true, "EnaSupport": "required", "EfaSupported": true}, "PlacementGroupInfo": {"SupportedStrategies": ["cluster", "partition", "spread"]}, "HibernationSupported": false, "BurstablePerformanceSupported": false, "DedicatedHostsSupported": true, "AutoRecoverySupported": true}, "g3.8xlarge": {"InstanceType": "g3.8xlarge", "CurrentGeneration": true, "FreeTierEligible": false, "SupportedUsageClasses": ["spot", "ondemand"], "SupportedRootDeviceTypes": ["ebs"], "SupportedVirtualizationTypes": ["hvm"], "BareMetal": false, "Hypervisor": "xen", "ProcessorInfo": {"SupportedArchitectures": ["x86_64"], "SustainedClockSpeedInGhz": 2.7}, "VCpuInfo": {"DefaultVCpus": 32, "DefaultCores": 16, "DefaultThreadsPerCore": 2, "ValidCores": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "ValidThreadsPerCore": [1, 2]}, "MemoryInfo": {"SizeInMiB": 249856}, "InstanceStorageSupported": false, "EbsInfo": {"EbsOptimizedSupport": "default", "EncryptionSupport": "supported", "EbsOptimizedInfo": {"BaselineBandwidthInMbps": 7000, "BaselineThroughputInMBps": 875.0, "BaselineIops": 40000, "MaximumBandwidthInMbps": 7000, "MaximumThroughputInMBps": 875.0, "MaximumIops": 40000}, "NvmeSupport": "unsupported"}, "NetworkInfo": {"NetworkPerformance": "10 Gigabit", "MaximumNetworkInterfaces": 8, "MaximumNetworkCards": 1, "DefaultNetworkCardIndex": 0, "NetworkCards": [{"NetworkCardIndex": 0, "NetworkPerformance": "10 Gigabit", "MaximumNetworkInterfaces": 8}], "Ipv4AddressesPerInterface": 30, "Ipv6AddressesPerInterface": 30, "Ipv6Supported": true, "EnaSupport": "supported", "EfaSupported": false}, "GpuInfo": {"Gpus": [{"Name": "M60", "Manufacturer": "NVIDIA", "Count": 2, "MemoryInfo": {"SizeInMiB": 8192}}], "TotalGpuMemoryInMiB": 16384}, "PlacementGroupInfo": {"SupportedStrategies": ["cluster", "partition", "spread"]}, "HibernationSupported": false, "BurstablePerformanceSupported": false, "DedicatedHostsSupported": true, "AutoRecoverySupported": false}, "p3dn.24xlarge": {"InstanceType": "p3dn.24xlarge", "CurrentGeneration": true, "FreeTierEligible": false, "SupportedUsageClasses": ["spot", "ondemand"], "SupportedRootDeviceTypes": ["ebs"], "SupportedVirtualizationTypes": ["hvm"], "BareMetal": false, "Hypervisor": "nitro", "ProcessorInfo": {"SupportedArchitectures": ["x86_64"], "SustainedClockSpeedInGhz": 2.5}, "VCpuInfo": {"DefaultVCpus": 96, "DefaultCores": 48, "DefaultThreadsPerCore": 2, "ValidCores": [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48], "ValidThreadsPerCore": [1, 2]}, "MemoryInfo": {"SizeInMiB": 786432}, "InstanceStorageSupported": true, "InstanceStorageInfo": {"TotalSizeInGB": 1800, "Disks": [{"SizeInGB": 900, "Count": 2, "Type": "ssd"}], "NvmeSupport": "required"}, "EbsInfo": {"EbsOptimizedSupport": "default", "EncryptionSupport": "supported", "EbsOptimizedInfo": {"BaselineBandwidthInMbps": 19000, "BaselineThroughputInMBps": 2375.0, "BaselineIops": 80000, "MaximumBandwidthInMbps": 19000, "MaximumThroughputInMBps": 2375.0, "MaximumIops": 80000}, "NvmeSupport": "required"}, "NetworkInfo": {"NetworkPerformance": "100 Gigabit", "MaximumNetworkInterfaces": 15, "MaximumNetworkCards": 1, "DefaultNetworkCardIndex": 0, "NetworkCards": [{"NetworkCardIndex": 0, "NetworkPerformance": "100 Gigabit", "MaximumNetworkInterfaces": 15}], "Ipv4AddressesPerInterface": 50, "Ipv6AddressesPerInterface": 50, "Ipv6Supported": true, "EnaSupport": "required", "EfaSupported": true}, "GpuInfo": {"Gpus": [{"Name": "V100", "Manufacturer": "NVIDIA", "Count": 8, "MemoryInfo": {"SizeInMiB": 32768}}], "TotalGpuMemoryInMiB": 262144}, "PlacementGroupInfo": {"SupportedStrategies": ["cluster", "partition", "spread"]}, "HibernationSupported": false, "BurstablePerformanceSupported": false, "DedicatedHostsSupported": false, "AutoRecoverySupported": false}}

0 commit comments

Comments
 (0)