Skip to content

Commit e77e02b

Browse files
author
Himani Deshpande
committed
Configure Enroot and Pyxis only on HeadNode
* Replacing sed commands with templates * Replacing creation of directories with chef resource * Adding Chef Attributes for enabling Pyxis and enroot * Creating pyxis conf in Config Phase gives no such file found error * Changing Kitchen test for Enroot and Pyxis
1 parent b00a0c6 commit e77e02b

File tree

8 files changed

+84
-18
lines changed

8 files changed

+84
-18
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
# Enroot + Pyxis
1313
default['cluster']['enroot']['version'] = '3.4.1'
14+
default['cluster']['enroot']['enabled'] = 'no'
1415
default['cluster']['pyxis']['version'] = '0.20.0'
16+
default['cluster']['pyxis']['enabled'] = 'no'
1517

1618
# NVidia
1719
default['cluster']['nvidia']['enabled'] = 'no'

cookbooks/aws-parallelcluster-platform/recipes/config.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
include_recipe 'aws-parallelcluster-platform::supervisord_config'
2727
fetch_config 'Fetch and load cluster configs'
2828
include_recipe 'aws-parallelcluster-platform::config_login' if node['cluster']['node_type'] == 'LoginNode'
29-
enroot 'Configure Enroot' do
30-
action :configure
29+
if node['cluster']['node_type'] == 'HeadNode'
30+
enroot 'Configure Enroot' do
31+
action :configure
32+
end
3133
end

cookbooks/aws-parallelcluster-platform/resources/enroot/partial/_enroot_common.rb

Lines changed: 58 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
action :configure do
2424
return if on_docker?
2525
return unless enroot_installed
26+
return unless configure_enroot
27+
return unless configure_pyxis
2628

2729
cookbook_file "/tmp/enroot.template.conf" do
2830
source 'enroot/enroot.template.conf'
@@ -33,33 +35,68 @@
3335
action :create_if_missing
3436
end
3537

38+
directory "#{node['cluster']['shared_dir']}/enroot" do
39+
owner node['cluster']['cluster_user']
40+
# group node['cluster']['cluster_user']
41+
mode '1777'
42+
action :create
43+
end
44+
45+
directory "#{node['cluster']['shared_dir']}/pyxis" do
46+
owner node['cluster']['cluster_user']
47+
# group node['cluster']['cluster_user']
48+
# mode '0755'
49+
action :create
50+
end
51+
52+
directory "/tmp/enroot/data" do
53+
mode '1777'
54+
action :create
55+
recursive true
56+
end
57+
3658
bash "Configure enroot" do
3759
user 'root'
3860
code <<-ENROOT_CONFIGURE
3961
set -e
4062
ENROOT_CONFIG_RELEASE=pyxis
4163
SHARED_DIR=#{node['cluster']['shared_dir']}
42-
NONROOT_USER=#{node['cluster']['cluster_user']}
43-
mkdir -p ${SHARED_DIR}/enroot
44-
chown ${NONROOT_USER} ${SHARED_DIR}/enroot
4564
ENROOT_CACHE_PATH=${SHARED_DIR}/enroot envsubst < /tmp/enroot.template.conf > /tmp/enroot.conf
4665
mv /tmp/enroot.conf /etc/enroot/enroot.conf
4766
chmod 0644 /etc/enroot/enroot.conf
67+
ENROOT_CONFIGURE
68+
retries 3
69+
retry_delay 5
70+
end
4871

49-
mkdir -p /tmp/enroot
50-
chmod 1777 /tmp/enroot
51-
mkdir -p /tmp/enroot/data
52-
chmod 1777 /tmp/enroot/data
72+
template "#{node['cluster']['slurm']['install_dir']}/etc/plugstack.conf" do
73+
source 'pyxis/plugstack.conf.erb'
74+
cookbook 'aws-parallelcluster-platform'
75+
owner 'root'
76+
group 'root'
77+
mode '0644'
78+
end
5379

54-
chmod 1777 ${SHARED_DIR}/enroot
80+
link '/usr/local/share/pyxis/pyxis.conf' do
81+
to "#{node['cluster']['slurm']['install_dir']}/etc/plugstack.conf.d/pyxis.conf"
82+
end
5583

56-
mkdir -p ${SHARED_DIR}/pyxis/
57-
chown ${NONROOT_USER} ${SHARED_DIR}/pyxis/
58-
sed -i '${s/$/ runtime_path=${SHARED_DIR}\\/pyxis/}' /opt/slurm/etc/plugstack.conf.d/pyxis.conf
84+
template "#{node['cluster']['slurm']['install_dir']}/etc/plugstack.conf.d/pyxis.conf " do
85+
source 'pyxis/pyxis.conf.erb'
86+
cookbook 'aws-parallelcluster-platform'
87+
owner 'root'
88+
group 'root'
89+
mode '0644'
90+
end
91+
92+
bash "Configure Pyxis" do
93+
user 'root'
94+
code <<-PYXIS_CONFIGURE
95+
set -e
96+
SHARED_DIR=#{node['cluster']['shared_dir']}
5997
SHARED_DIR=${SHARED_DIR} envsubst < /opt/slurm/etc/plugstack.conf.d/pyxis.conf > /opt/slurm/etc/plugstack.conf.d/pyxis.tmp.conf
6098
mv /opt/slurm/etc/plugstack.conf.d/pyxis.tmp.conf /opt/slurm/etc/plugstack.conf.d/pyxis.conf
61-
62-
ENROOT_CONFIGURE
99+
PYXIS_CONFIGURE
63100
retries 3
64101
retry_delay 5
65102
end
@@ -72,3 +109,11 @@ def package_version
72109
def enroot_installed
73110
::File.exist?('/usr/bin/enroot')
74111
end
112+
113+
def configure_enroot
114+
['yes', true].include?(node['cluster']['enroot']['enabled'])
115+
end
116+
117+
def configure_pyxis
118+
['yes', true].include?(node['cluster']['pyxis']['enabled'])
119+
end
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
required /usr/local/lib/slurm/spank_pyxis.so
2+
runtime_path=<%= node['cluster']['shared_dir'] %>/pyxis/

cookbooks/aws-parallelcluster-platform/test/controls/enroot_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
expected_enroot_version = node['cluster']['enroot']['version']
1616

17-
describe "gdrcopy version is expected to be #{expected_enroot_version}" do
17+
describe "enroot version is expected to be #{expected_enroot_version}" do
1818
subject { command('enroot version').stdout.strip() }
1919
it { should eq expected_enroot_version }
2020
end

cookbooks/aws-parallelcluster-slurm/recipes/install/install_pyxis.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,19 @@
3838
CPPFLAGS='-I /opt/slurm/include/' make
3939
CPPFLAGS='-I /opt/slurm/include/' make install
4040
mkdir -p /opt/slurm/etc/plugstack.conf.d
41-
echo -e 'include /opt/slurm/etc/plugstack.conf.d/*' | tee /opt/slurm/etc/plugstack.conf
42-
ln -fs /usr/local/share/pyxis/pyxis.conf /opt/slurm/etc/plugstack.conf.d/pyxis.conf
4341
PYXIS_INSTALL
4442
retries 3
4543
retry_delay 5
4644
end
45+
46+
template "#{node['cluster']['slurm']['install_dir']}/etc/plugstack.conf" do
47+
source 'pyxis/plugstack.conf.erb'
48+
cookbook 'aws-parallelcluster-slurm'
49+
owner 'root'
50+
group 'root'
51+
mode '0644'
52+
end
53+
54+
link '/usr/local/share/pyxis/pyxis.conf' do
55+
to "#{node['cluster']['slurm']['install_dir']}/etc/plugstack.conf.d/pyxis.conf"
56+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include /opt/slurm/etc/plugstack.conf.d/*

cookbooks/aws-parallelcluster-slurm/test/controls/pyxis_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
title 'Checks Pyxis has been installed'
1616

17+
describe directory('/opt/slurm/etc/plugstack.conf.d') do
18+
it { should exist }
19+
end
20+
1721
describe file("/opt/slurm/etc/plugstack.conf.d/pyxis.conf") do
1822
it { should exist }
1923
end

0 commit comments

Comments
 (0)