Skip to content

Commit

Permalink
Configure Enroot and Pyxis only on HeadNode
Browse files Browse the repository at this point in the history
* Replacing sed commands with templates
  • Loading branch information
Himani Deshpande committed Oct 10, 2024
1 parent b00a0c6 commit 8998aff
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 10 deletions.
6 changes: 4 additions & 2 deletions cookbooks/aws-parallelcluster-platform/recipes/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
include_recipe 'aws-parallelcluster-platform::supervisord_config'
fetch_config 'Fetch and load cluster configs'
include_recipe 'aws-parallelcluster-platform::config_login' if node['cluster']['node_type'] == 'LoginNode'
enroot 'Configure Enroot' do
action :configure
if node['cluster']['node_type'] == 'HeadNode'
enroot 'Configure Enroot' do
action :configure
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,28 @@
action :create_if_missing
end

directory "#{node['cluster']['shared_dir']}/enroot" do
owner node['cluster']['cluster_user']
# group node['cluster']['cluster_user']
# mode '0755'
action :create
end

directory "#{node['cluster']['shared_dir']}/pyxis" do
owner node['cluster']['cluster_user']
# group node['cluster']['cluster_user']
# mode '0755'
action :create
end

bash "Configure enroot" do
user 'root'
code <<-ENROOT_CONFIGURE
set -e
ENROOT_CONFIG_RELEASE=pyxis
SHARED_DIR=#{node['cluster']['shared_dir']}
NONROOT_USER=#{node['cluster']['cluster_user']}
mkdir -p ${SHARED_DIR}/enroot
chown ${NONROOT_USER} ${SHARED_DIR}/enroot
ENROOT_CACHE_PATH=${SHARED_DIR}/enroot envsubst < /tmp/enroot.template.conf > /tmp/enroot.conf
mv /tmp/enroot.conf /etc/enroot/enroot.conf
chmod 0644 /etc/enroot/enroot.conf
Expand All @@ -53,13 +66,41 @@
chmod 1777 ${SHARED_DIR}/enroot
mkdir -p ${SHARED_DIR}/pyxis/
chown ${NONROOT_USER} ${SHARED_DIR}/pyxis/
sed -i '${s/$/ runtime_path=${SHARED_DIR}\\/pyxis/}' /opt/slurm/etc/plugstack.conf.d/pyxis.conf
ENROOT_CONFIGURE
retries 3
retry_delay 5
end

template "#{node['cluster']['slurm']['install_dir']}/etc/plugstack.conf" do
source 'pyxis/plugstack.conf.erb'
cookbook 'aws-parallelcluster-platform'
owner 'root'
group 'root'
mode '0644'
end


link '/usr/local/share/pyxis/pyxis.conf' do
to "#{node['cluster']['slurm']['install_dir']}/etc/plugstack.conf.d/pyxis.conf"
end

template "#{node['cluster']['slurm']['install_dir']}/etc/plugstack.conf.d/pyxis.conf " do
source 'pyxis/pyxis.conf.erb'
cookbook 'aws-parallelcluster-platform'
owner 'root'
group 'root'
mode '0644'
end


bash "Configure Pyxis" do
user 'root'
code <<-PYXIS_CONFIGURE
SHARED_DIR=#{node['cluster']['shared_dir']}
SHARED_DIR=${SHARED_DIR} envsubst < /opt/slurm/etc/plugstack.conf.d/pyxis.conf > /opt/slurm/etc/plugstack.conf.d/pyxis.tmp.conf
mv /opt/slurm/etc/plugstack.conf.d/pyxis.tmp.conf /opt/slurm/etc/plugstack.conf.d/pyxis.conf
ENROOT_CONFIGURE
PYXIS_CONFIGURE
retries 3
retry_delay 5
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include /opt/slurm/etc/plugstack.conf.d/*
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
runtime_path=<%= node['cluster']['shared_dir'] %>/pyxis/
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
CPPFLAGS='-I /opt/slurm/include/' make
CPPFLAGS='-I /opt/slurm/include/' make install
mkdir -p /opt/slurm/etc/plugstack.conf.d
echo -e 'include /opt/slurm/etc/plugstack.conf.d/*' | tee /opt/slurm/etc/plugstack.conf
ln -fs /usr/local/share/pyxis/pyxis.conf /opt/slurm/etc/plugstack.conf.d/pyxis.conf
PYXIS_INSTALL
retries 3
retry_delay 5
Expand Down

0 comments on commit 8998aff

Please sign in to comment.