Skip to content

Commit b2d27a2

Browse files
himani2411Himani Anil Deshpande
andauthored
[SlurmTopo] Remove queue update check as it doesnt support idempotency with force-configuration option (#3010)
* we dont actually check for capacity block update just an update of scehduling section which is not necessarily helpful Co-authored-by: Himani Anil Deshpande <[email protected]>
1 parent a2651f4 commit b2d27a2

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

cookbooks/aws-parallelcluster-slurm/files/default/head_node_slurm/slurm/pcluster_topology_generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ def generate_topology_config_file( # noqa: C901
6666
Generate topology.conf
6767
6868
# This file is automatically generated by pcluster
69-
BlockName=block1 Nodes=queue-1-st-compute-resource-0-[1-9] #### 9 nodes
70-
BlockName=block2 Nodes=queue-1-st-compute-resource-0-[1-18] #### 18 nodes
69+
BlockName=block1 Nodes=queue-1-st-compute-resource-0-[1-9] #### 9 nodes Capacity Block 1
70+
BlockName=block2 Nodes=queue-1-st-compute-resource-0-[1-18] #### 18 nodes Capacity Block 2
7171
BlockSizes=9,18
7272
"""
7373
if block_sizes:

cookbooks/aws-parallelcluster-slurm/resources/block_topology/partial/_block_topology_common.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def is_block_topology_supported?
6060
end
6161

6262
def topology_generator_command_args
63-
if node['cluster']['p6egb200_block_sizes'].nil? && are_queues_updated? && ::File.exist?("#{node['cluster']['slurm']['install_dir']}/etc/topology.conf")
63+
if node['cluster']['p6egb200_block_sizes'].nil? && ::File.exist?("#{node['cluster']['slurm']['install_dir']}/etc/topology.conf")
6464
# If topology.conf exist and Capacity Block is removed, we cleanup
6565
" --cleanup"
6666
elsif !node['cluster']['p6egb200_block_sizes'].nil?

cookbooks/aws-parallelcluster-slurm/spec/unit/resources/block_topology_spec.rb

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def self.update(chef_run)
2121
script_dir = 'SCRIPT_DIR'
2222
slurm_install_dir = 'SLURM_INSTALL_DIR'
2323
block_sizes = '9,18'
24+
new_block_size = '1,2'
2425
cluster_config = 'CONFIG_YAML'
2526
cookbook_env = 'FAKE_COOKBOOK_PATH'
2627
force_configuration_extra_args = ' --force-configuration'
@@ -162,9 +163,8 @@ def self.update(chef_run)
162163
chef_run.find_resource('block_topology', 'update')
163164
end
164165

165-
context "when queues are updated and topolog.conf does exists" do
166+
context "when capacity block is removed and topolog.conf does exists" do
166167
before do
167-
allow_any_instance_of(Object).to receive(:are_queues_updated?).and_return(true)
168168
allow(File).to receive(:exist?).with("#{slurm_install_dir}/etc/topology.conf").and_return(true)
169169
chef_run.node.override['cluster']['p6egb200_block_sizes'] = nil
170170
end
@@ -174,20 +174,19 @@ def self.update(chef_run)
174174
end
175175
end
176176

177-
context "when queues are not updated and topolog.conf does not exists" do
177+
context "when capacity block is not used and topolog.conf does not exists" do
178178
before do
179-
allow_any_instance_of(Object).to receive(:are_queues_updated?).and_return(false)
180179
allow(File).to receive(:exist?).with("#{slurm_install_dir}/etc/topology.conf").and_return(false)
180+
chef_run.node.override['cluster']['p6egb200_block_sizes'] = nil
181181
end
182182

183183
it 'it gives nil' do
184184
expect(resource.topology_generator_command_args).to eq(nil)
185185
end
186186
end
187187

188-
context "when queues are updated and topolog.conf does not exists" do
188+
context "when capacity block is updated and topolog.conf does not exists" do
189189
before do
190-
allow_any_instance_of(Object).to receive(:are_queues_updated?).and_return(true)
191190
allow(File).to receive(:exist?).with("#{slurm_install_dir}/etc/topology.conf").and_return(false)
192191
chef_run.node.override['cluster']['p6egb200_block_sizes'] = block_sizes
193192
end
@@ -197,6 +196,17 @@ def self.update(chef_run)
197196
end
198197
end
199198

199+
context "when capacity block is updated and topolog.conf does exists" do
200+
before do
201+
allow(File).to receive(:exist?).with("#{slurm_install_dir}/etc/topology.conf").and_return(true)
202+
chef_run.node.override['cluster']['p6egb200_block_sizes'] = new_block_size
203+
end
204+
205+
it 'returns block-sizes argument' do
206+
expect(resource.topology_generator_command_args).to eq(" --block-sizes #{new_block_size}")
207+
end
208+
end
209+
200210
context "when block sizes is not nil" do
201211
before do
202212
chef_run.node.override['cluster']['p6egb200_block_sizes'] = block_sizes

0 commit comments

Comments
 (0)