Skip to content

Commit 42675cb

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 42675cb

File tree

8 files changed

+62
-22
lines changed

8 files changed

+62
-22
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# Enroot + Pyxis
1313
default['cluster']['enroot']['version'] = '3.4.1'
1414
default['cluster']['pyxis']['version'] = '0.20.0'
15+
default['cluster']['pyxis']['enabled'] = 'no'
1516

1617
# NVidia
1718
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: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
action :configure do
2424
return if on_docker?
2525
return unless enroot_installed
26+
return unless configure_pyxis
2627

2728
cookbook_file "/tmp/enroot.template.conf" do
2829
source 'enroot/enroot.template.conf'
@@ -33,36 +34,52 @@
3334
action :create_if_missing
3435
end
3536

37+
directory "#{node['cluster']['shared_dir']}/enroot" do
38+
owner node['cluster']['cluster_user']
39+
# group node['cluster']['cluster_user']
40+
mode '1777'
41+
action :create
42+
end
43+
44+
directory "#{node['cluster']['shared_dir']}/pyxis" do
45+
owner node['cluster']['cluster_user']
46+
# group node['cluster']['cluster_user']
47+
# mode '0755'
48+
action :create
49+
end
50+
51+
directory "/tmp/enroot" do
52+
mode '1777'
53+
action :create
54+
end
55+
56+
directory "/tmp/enroot/data" do
57+
mode '1777'
58+
action :create
59+
end
60+
3661
bash "Configure enroot" do
3762
user 'root'
3863
code <<-ENROOT_CONFIGURE
3964
set -e
4065
ENROOT_CONFIG_RELEASE=pyxis
4166
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
4567
ENROOT_CACHE_PATH=${SHARED_DIR}/enroot envsubst < /tmp/enroot.template.conf > /tmp/enroot.conf
4668
mv /tmp/enroot.conf /etc/enroot/enroot.conf
4769
chmod 0644 /etc/enroot/enroot.conf
48-
49-
mkdir -p /tmp/enroot
50-
chmod 1777 /tmp/enroot
51-
mkdir -p /tmp/enroot/data
52-
chmod 1777 /tmp/enroot/data
53-
54-
chmod 1777 ${SHARED_DIR}/enroot
55-
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
59-
SHARED_DIR=${SHARED_DIR} envsubst < /opt/slurm/etc/plugstack.conf.d/pyxis.conf > /opt/slurm/etc/plugstack.conf.d/pyxis.tmp.conf
60-
mv /opt/slurm/etc/plugstack.conf.d/pyxis.tmp.conf /opt/slurm/etc/plugstack.conf.d/pyxis.conf
61-
6270
ENROOT_CONFIGURE
6371
retries 3
6472
retry_delay 5
6573
end
74+
75+
template "#{node['cluster']['slurm']['install_dir']}/etc/plugstack.conf.d/pyxis.conf " do
76+
source 'pyxis/pyxis.conf.erb'
77+
cookbook 'aws-parallelcluster-platform'
78+
owner 'root'
79+
group 'root'
80+
mode '0755' # TODO: Chnage the permission
81+
end
82+
6683
end
6784

6885
def package_version
@@ -72,3 +89,7 @@ def package_version
7289
def enroot_installed
7390
::File.exist?('/usr/bin/enroot')
7491
end
92+
93+
def configure_pyxis
94+
['yes', true].include?(node['cluster']['pyxis']['enabled'])
95+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
required /usr/local/lib/slurm/spank_pyxis.so 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)