Skip to content

Commit 17b882a

Browse files
author
Himani Anil Deshpande
committed
[SlurmTopo] Do not support Slurm Topology for AL2
1 parent b60dd5e commit 17b882a

File tree

4 files changed

+33
-29
lines changed

4 files changed

+33
-29
lines changed

cookbooks/aws-parallelcluster-slurm/libraries/helpers.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,7 @@ def check_for_protected_mode(fleet_status_command) # rubocop:disable Lint/Nested
242242
def get_login_node_pool_config(config, pool_name)
243243
config['LoginNodes']['Pools'].select { |pool| pool['Name'] == pool_name }.first
244244
end
245+
246+
def is_amazon_linux_2?
247+
platform?('amazon') && node['platform_version'] == "2"
248+
end

cookbooks/aws-parallelcluster-slurm/recipes/config/config_head_node.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
owner 'root'
4646
group 'root'
4747
mode '0644'
48+
variables( is_amazon_linux_2: is_amazon_linux_2? )
4849
end
4950

5051
template "#{node['cluster']['slurm']['install_dir']}/etc/gres.conf" do
@@ -60,7 +61,7 @@
6061
owner 'root'
6162
group 'root'
6263
mode '0644'
63-
not_if { platform?('amazon') && node['platform_version'] == "2" }
64+
not_if { is_amazon_linux_2? }
6465
end
6566

6667
unless on_docker?

cookbooks/aws-parallelcluster-slurm/recipes/update/update_head_node.rb

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -151,35 +151,34 @@ def update_nodes_in_queue(strategy, queues)
151151
end
152152
end
153153

154-
ruby_block "Update slurm topology" do
155-
block do
156-
# Update slurm_parallelcluster_topology to add/remove Block Topology plugin
157-
template "#{node['cluster']['slurm']['install_dir']}/etc/slurm_parallelcluster_topology.conf" do
158-
source 'slurm/slurm_parallelcluster_topology.conf.erb'
159-
owner 'root'
160-
group 'root'
161-
mode '0644'
162-
end
154+
# Update slurm_parallelcluster_topology to add/remove Block Topology plugin
155+
template "#{node['cluster']['slurm']['install_dir']}/etc/slurm_parallelcluster_topology.conf" do
156+
source 'slurm/slurm_parallelcluster_topology.conf.erb'
157+
owner 'root'
158+
group 'root'
159+
mode '0644'
160+
not_if { is_amazon_linux_2? }
161+
end
163162

164-
if node['cluster']['p6egb200_block_sizes'].nil? && are_queues_updated? && ::File.exist?("#{node['cluster']['slurm']['install_dir']}/etc/topology.conf")
165-
# If topology.conf exist and Capacity Block is removed, we cleanup
166-
topology_generator_command_args = " --cleanup"
167-
elsif node['cluster']['p6egb200_block_sizes'].nil? && !are_queues_updated?
168-
# We do nothing if p6e-gb200 is not used and queues are not updated
169-
topology_generator_command_args = nil
170-
else
171-
topology_generator_command_args = " --block-sizes #{node['cluster']['p6egb200_block_sizes']}"
172-
end
173-
# Update Slurm topology.conf file
174-
execute "update or cleanup topology.conf" do
175-
command "#{cookbook_virtualenv_path}/bin/python #{node['cluster']['scripts_dir']}/slurm/pcluster_topology_generator.py"\
176-
" --output-file #{node['cluster']['slurm']['install_dir']}/etc/topology.conf"\
177-
" --input-file #{node['cluster']['cluster_config_path']}"\
178-
"#{topology_generator_command_args}"
179-
not_if { ::File.exist?(node['cluster']['previous_cluster_config_path']) && topology_generator_command_args.nil? }
180-
end
163+
def topology_generator_command_args
164+
if node['cluster']['p6egb200_block_sizes'].nil? && are_queues_updated? && ::File.exist?("#{node['cluster']['slurm']['install_dir']}/etc/topology.conf")
165+
# If topology.conf exist and Capacity Block is removed, we cleanup
166+
" --cleanup"
167+
elsif node['cluster']['p6egb200_block_sizes'].nil? && !are_queues_updated?
168+
# We do nothing if p6e-gb200 is not used and queues are not updated
169+
nil
170+
else
171+
" --block-sizes #{node['cluster']['p6egb200_block_sizes']}"
181172
end
182-
not_if { platform?('amazon') && node['platform_version'] == "2" }
173+
end
174+
175+
# Update Slurm topology.conf file
176+
execute "update or cleanup topology.conf" do
177+
command "#{cookbook_virtualenv_path}/bin/python #{node['cluster']['scripts_dir']}/slurm/pcluster_topology_generator.py"\
178+
" --output-file #{node['cluster']['slurm']['install_dir']}/etc/topology.conf"\
179+
" --input-file #{node['cluster']['cluster_config_path']}"\
180+
"#{topology_generator_command_args}"
181+
not_if { ::File.exist?(node['cluster']['previous_cluster_config_path']) && topology_generator_command_args.nil? || is_amazon_linux_2? }
183182
end
184183

185184
execute "generate_pcluster_slurm_configs" do

cookbooks/aws-parallelcluster-slurm/templates/default/slurm/slurm.conf.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ include slurm_parallelcluster.conf
8484
# WARNING!!! The custom_slurm_settings_include_file_slurm.conf file included below can be updated by the pcluster process.
8585
# Please do not edit it.
8686
include pcluster/custom_slurm_settings_include_file_slurm.conf
87-
<% unless platform?('amazon') && node['platform_version'] == "2" -%>
87+
<% unless @is_amazon_linux_2 -%>
8888
#
8989
# WARNING!!! The slurm_parallelcluster_topology.conf file included below can be updated by the pcluster process.
9090
# Please do not edit it.

0 commit comments

Comments
 (0)