Skip to content

Commit 3d09cb9

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 3d09cb9

File tree

9 files changed

+62
-37
lines changed

9 files changed

+62
-37
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: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,45 +23,47 @@
2323
action :configure do
2424
return if on_docker?
2525
return unless enroot_installed
26+
return unless configure_pyxis
2627

27-
cookbook_file "/tmp/enroot.template.conf" do
28-
source 'enroot/enroot.template.conf'
28+
template "/etc/enroot/enroot.conf" do
29+
source 'enroot/enroot.conf.erb'
2930
cookbook 'aws-parallelcluster-platform'
3031
owner 'root'
3132
group 'root'
32-
mode '0755'
33-
action :create_if_missing
33+
mode '0644'
34+
action :create
3435
end
3536

36-
bash "Configure enroot" do
37-
user 'root'
38-
code <<-ENROOT_CONFIGURE
39-
set -e
40-
ENROOT_CONFIG_RELEASE=pyxis
41-
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
45-
ENROOT_CACHE_PATH=${SHARED_DIR}/enroot envsubst < /tmp/enroot.template.conf > /tmp/enroot.conf
46-
mv /tmp/enroot.conf /etc/enroot/enroot.conf
47-
chmod 0644 /etc/enroot/enroot.conf
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
4843

49-
mkdir -p /tmp/enroot
50-
chmod 1777 /tmp/enroot
51-
mkdir -p /tmp/enroot/data
52-
chmod 1777 /tmp/enroot/data
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
5350

54-
chmod 1777 ${SHARED_DIR}/enroot
51+
directory "/tmp/enroot" do
52+
mode '1777'
53+
action :create
54+
end
5555

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
56+
directory "/tmp/enroot/data" do
57+
mode '1777'
58+
action :create
59+
end
6160

62-
ENROOT_CONFIGURE
63-
retries 3
64-
retry_delay 5
61+
template "#{node['cluster']['slurm']['install_dir']}/etc/plugstack.conf.d/pyxis.conf " do
62+
source 'pyxis/pyxis.conf.erb'
63+
cookbook 'aws-parallelcluster-platform'
64+
owner 'root'
65+
group 'root'
66+
mode '0755' # TODO: Chnage the permission
6567
end
6668
end
6769

@@ -72,3 +74,7 @@ def package_version
7274
def enroot_installed
7375
::File.exist?('/usr/bin/enroot')
7476
end
77+
78+
def configure_pyxis
79+
['yes', true].include?(node['cluster']['pyxis']['enabled'])
80+
end

cookbooks/aws-parallelcluster-platform/files/enroot/enroot.template.conf renamed to cookbooks/aws-parallelcluster-platform/templates/enroot/enroot.conf.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#ENROOT_LIBRARY_PATH /usr/lib/enroot
22
#ENROOT_SYSCONF_PATH /etc/enroot
33
ENROOT_RUNTIME_PATH /tmp/enroot/user-$(id -u)
4-
ENROOT_CONFIG_PATH ${ENROOT_CONFIG_PATH}
5-
ENROOT_CACHE_PATH ${ENROOT_CACHE_PATH}
4+
ENROOT_CONFIG_PATH
5+
ENROOT_CACHE_PATH <%= node['cluster']['shared_dir'] %>/enroot
66
ENROOT_DATA_PATH /tmp/enroot/data/user-$(id -u)
77
#ENROOT_TEMP_PATH ${TMPDIR:-/tmp}
88

@@ -68,4 +68,4 @@ ENROOT_RESTRICT_DEV no
6868
#all_proxy
6969
#no_proxy
7070
#http_proxy
71-
#https_proxy
71+
#https_proxy
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)