Skip to content

Commit edf7a31

Browse files
NSsirenaenrico-usai
authored andcommitted
Rebase code on top of munge resource definition
1 parent d247d01 commit edf7a31

File tree

9 files changed

+37
-49
lines changed

9 files changed

+37
-49
lines changed

attributes/default.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,13 @@
103103
].join('/')
104104

105105
# URLs to software packages used during install recipes
106-
# # Slurm software
107106
default['cluster']['slurm_plugin_dir'] = '/etc/parallelcluster/slurm_plugin'
108107
default['cluster']['slurm']['fleet_config_path'] = "#{node['cluster']['slurm_plugin_dir']}/fleet-config.json"
108+
# Slurm
109+
default['cluster']['slurm']['user'] = 'slurm'
110+
default['cluster']['slurm']['user_id'] = node['cluster']['reserved_base_uid'] + 1
111+
default['cluster']['slurm']['group'] = node['cluster']['slurm']['user']
112+
default['cluster']['slurm']['group_id'] = node['cluster']['slurm']['user_id']
109113
# Munge
110114
default['cluster']['munge']['user'] = 'munge'
111115
default['cluster']['munge']['user_id'] = node['cluster']['reserved_base_uid'] + 2

cookbooks/aws-parallelcluster-common/attributes/common.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,3 @@
5050
# EFA
5151
default['cluster']['efa']['installer_version'] = '1.21.0'
5252
default['cluster']['efa']['unsupported_aarch64_oses'] = %w(centos7)
53-
54-
# Users
55-
default['cluster']['reserved_base_uid'] = 400
56-
default['cluster']['slurm']['user'] = 'slurm'
57-
default['cluster']['slurm']['user_id'] = node['cluster']['reserved_base_uid'] + 1
58-
default['cluster']['slurm']['group'] = node['cluster']['slurm']['user']
59-
default['cluster']['slurm']['group_id'] = node['cluster']['slurm']['user_id']
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Slurm attributes shared between install_slurm and configure_slurm_accounting
2-
default['cluster']['slurm']['version'] = '22-05-8-1'
32
default['cluster']['slurm']['commit'] = ''
43
default['cluster']['slurm']['sha256'] = '8c8f6a26a5d51e6c63773f2e02653eb724540ee8b360125c8d7732314ce737d6'
54
default['cluster']['slurm']['install_dir'] = '/opt/slurm'
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# Slurm
2+
default['cluster']['slurm']['version'] = '22-05-8-1'
13
# Munge
24
default['cluster']['munge']['munge_version'] = '0.5.14'

cookbooks/aws-parallelcluster-slurm/recipes/install_jwt.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,10 @@
2525
mode '0644'
2626
retries 3
2727
retry_delay 5
28+
checksum jwt_sha256
2829
action :create_if_missing
2930
end
3031

31-
ruby_block "Validate libjwt Tarball Checksum" do
32-
block do
33-
require 'digest'
34-
checksum = Digest::SHA256.file(jwt_tarball).hexdigest
35-
raise "Downloaded Tarball Checksum #{checksum} does not match expected checksum #{jwt_sha256}" if checksum != jwt_sha256
36-
end
37-
end
38-
3932
jwt_dependencies 'Install jwt dependencies'
4033

4134
bash 'libjwt' do

cookbooks/aws-parallelcluster-slurm/recipes/install_pmix.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,10 @@
2626
mode '0644'
2727
retries 3
2828
retry_delay 5
29+
checksum pmix_sha256
2930
action :create_if_missing
3031
end
3132

32-
ruby_block "Validate PMIx Tarball Checksum" do
33-
block do
34-
require 'digest'
35-
checksum = Digest::SHA256.file(pmix_tarball).hexdigest
36-
raise "Downloaded Tarball Checksum #{checksum} does not match expected checksum #{pmix_sha256}" if checksum != pmix_sha256
37-
end
38-
end
39-
4033
bash 'Install PMIx' do
4134
user 'root'
4235
group 'root'

cookbooks/aws-parallelcluster-slurm/recipes/install_slurm.rb

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@
2323
slurm_group_id = node['cluster']['slurm']['group_id']
2424
slurm_install_dir = node['cluster']['slurm']['install_dir']
2525

26-
slurm_version = '22-05-8-1'
27-
slurm_commit = ''
26+
slurm_version = node['cluster']['slurm']['version']
27+
slurm_commit = node['cluster']['slurm']['commit']
2828
slurm_tar_name = if slurm_commit.empty?
2929
"slurm-#{slurm_version}"
3030
else
3131
"#{slurm_commit}"
3232
end
3333
slurm_tarball = "#{node['cluster']['sources_dir']}/#{slurm_tar_name}.tar.gz"
3434
slurm_url = "https://github.com/SchedMD/slurm/archive/#{slurm_tar_name}.tar.gz"
35-
slurm_sha256 = '8c8f6a26a5d51e6c63773f2e02653eb724540ee8b360125c8d7732314ce737d6'
35+
slurm_sha256 = node['cluster']['slurm']['sha256']
3636

3737
# Setup slurm group
3838
group slurm_group do
@@ -59,17 +59,9 @@
5959
mode '0644'
6060
retries 3
6161
retry_delay 5
62+
checksum slurm_sha256
6263
action :create_if_missing
63-
end unless redhat_ubi?
64-
65-
# Validate the authenticity of the downloaded archive based on the checksum published by SchedMD
66-
ruby_block "Validate Slurm Tarball Checksum" do
67-
block do
68-
require 'digest'
69-
checksum = Digest::SHA256.file(slurm_tarball).hexdigest
70-
raise "Downloaded Tarball Checksum #{checksum} does not match expected checksum #{slurm_sha256}" if checksum != slurm_sha256
71-
end
72-
end unless redhat_ubi?
64+
end
7365

7466
# Copy Slurm patches
7567
remote_directory "#{node['cluster']['sources_dir']}/slurm_patches" do
@@ -81,6 +73,7 @@
8173

8274
# Install Slurm
8375
bash 'make install' do
76+
not_if { redhat_ubi? }
8477
user 'root'
8578
group 'root'
8679
cwd Chef::Config[:file_cache_path]
@@ -115,12 +108,13 @@
115108
SLURM
116109
# TODO: Fix, so it works for upgrade
117110
creates "#{slurm_install_dir}/bin/srun"
118-
end unless redhat_ubi?
111+
end
119112

120113
# Copy required licensing files
121114
directory "#{node['cluster']['license_dir']}/slurm"
122115

123116
bash 'copy license stuff' do
117+
not_if { redhat_ubi? }
124118
user 'root'
125119
group 'root'
126120
cwd Chef::Config[:file_cache_path]
@@ -134,9 +128,10 @@
134128
SLURMLICENSE
135129
# TODO: Fix, so it works for upgrade
136130
creates "#{node['cluster']['license_dir']}/slurm/README.rst"
137-
end unless redhat_ubi?
131+
end
138132

139133
file '/etc/ld.so.conf.d/slurm.conf' do
134+
not_if { redhat_ubi? }
140135
content "#{slurm_install_dir}/lib/"
141136
mode '0744'
142-
end unless redhat_ubi?
137+
end

cookbooks/aws-parallelcluster-slurm/resources/munge/partial/_munge_actions.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
# Updated munge init script for Amazon Linux
7979
template '/etc/init.d/munge' do
8080
source 'munge/munge-init.erb'
81+
cookbook 'aws-parallelcluster-slurm'
8182
owner 'root'
8283
group 'root'
8384
variables(munge_user: munge_user,

test/recipes/controls/aws_parallelcluster_slurm/install_slurm_spec.rb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@
1717
control 'slurm_installed' do
1818
title 'Checks slurm has been installed'
1919

20+
only_if { !os_properties.redhat_ubi? }
21+
2022
describe file("/opt/slurm") do
2123
it { should exist }
2224
it { should be_directory }
2325
its('mode') { should cmp '0755' }
2426
its('owner') { should eq 'root' }
2527
its('group') { should eq 'root' }
2628
end
27-
end unless os_properties.redhat_ubi?
29+
end
2830

2931
control 'slurm_user_and_group_created' do
30-
title 'Check slrum user and group exist and are properly configured'
32+
title 'Check slurm user and group exist and are properly configured'
3133

3234
describe group(slurm_group) do
3335
it { should exist }
@@ -37,11 +39,13 @@
3739
it { should exist }
3840
its('group') { should eq slurm_group }
3941
end
40-
end unless os_properties.redhat_ubi?
42+
end
4143

4244
control 'slurm_licence_configured' do
4345
title 'Checks slurm licences folder has the required files'
4446

47+
only_if { !os_properties.redhat_ubi? }
48+
4549
describe file(slurm_license_path) do
4650
it { should exist }
4751
it { should be_directory }
@@ -77,10 +81,12 @@
7781
its('owner') { should eq 'root' }
7882
its('group') { should eq 'root' }
7983
end
80-
end unless os_properties.redhat_ubi?
84+
end
8185

82-
control 'slurm_plugin_libraries_compiled' do
83-
title 'Checks that all required slurm plugin libraries were compiled'
86+
control 'slurm_shared_libraries_compiled' do
87+
title 'Checks that all required slurm shared libraries were compiled'
88+
89+
only_if { !os_properties.redhat_ubi? }
8490

8591
describe file("#{slurm_library_folder}/accounting_storage_mysql.so") do
8692
it { should exist }
@@ -109,11 +115,13 @@
109115
its('owner') { should eq 'root' }
110116
its('group') { should eq 'root' }
111117
end
112-
end unless os_properties.redhat_ubi?
118+
end
113119

114120
control 'slurm_library_shared' do
115121
title 'Checks slurm shared library is part of the runtime search path'
116122

123+
only_if { !os_properties.redhat_ubi? }
124+
117125
describe file("/etc/ld.so.conf.d/slurm.conf") do
118126
it { should exist }
119127
its('mode') { should cmp '0744' }
@@ -123,4 +131,4 @@
123131
should match('/opt/slurm/lib/')
124132
end
125133
end
126-
end unless os_properties.redhat_ubi?
134+
end

0 commit comments

Comments
 (0)