Skip to content

Commit

Permalink
Fetch slurmdbd configuration from S3 if available
Browse files Browse the repository at this point in the history
Remove previously implemented logic to configur s3 mountpoint
for the configuration of the external slurmdbd

Signed-off-by: Jacopo De Amicis <[email protected]>
  • Loading branch information
jdeamicis committed Feb 1, 2024
1 parent ba89b38 commit 0f8a2c1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@

include_recipe 'aws-parallelcluster-slurm::config_head_node_directories'

include_recipe 'aws-parallelcluster-slurm::config_external_slurmdbd_s3_mountpoint'

# TODO: move this template to a separate recipe
# TODO: add a logic in update_munge_key.sh.erb to skip sharing munge key to shared dir
template "#{node['cluster']['scripts_dir']}/slurm/update_munge_key.sh" do
Expand All @@ -80,4 +78,6 @@
# TODO: add a logic in munge_key_manager to skip sharing munge key to shared dir
include_recipe 'aws-parallelcluster-slurm::config_munge_key'

include_recipe 'aws-parallelcluster-slurm::retrieve_slurmdbd_config_from_s3'

include_recipe "aws-parallelcluster-slurm::config_slurm_accounting"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#
# Cookbook:: aws-parallelcluster-slurm
# Recipe:: config_external_slurmdbd_s3_mountpoint
# Recipe:: retrieve_slurmdbd_config_from_s3
#
# Copyright:: 2013-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
Expand All @@ -20,31 +20,21 @@
# This is considered fine for the external slurmdbd stack.
# A deeper evaluation would be required for further uses of this tool in AWS ParallelCluster.

ext = platform?('ubuntu') ? "deb" : "rpm"
subtree = arm? ? "arm64" : "x86_64"
mount_s3_url = "https://s3.amazonaws.com/mountpoint-s3-release/latest/#{subtree}/mount-s3.#{ext}"
download_path = "/tmp/mount-s3.#{ext}"
bucket_name = node['slurmdbd_conf_bucket']
config_files = ["slurmdbd.conf", "slurm_external_slurmdbd.conf"]

remote_file 'download mountpoint-s3' do
source mount_s3_url
path download_path
retries 3
retry_delay 5
action :create_if_missing
end
config_files.each do |config_file|

if platform?('ubuntu')
# The Chef apt_package resource does not support the source attribute, so we use the dpkg_package resource instead.
dpkg_package "Install mountpoint-s3" do
source download_path
end
else
package "Install mountpoint-s3" do
source download_path
remote_object config_file do
url "s3://#{bucket_name}/#{config_file}"
destination "#{node['cluster']['slurm']['install_dir']}/etc/#{config_file}"
sensitive true
ignore_failure true
end
end

execute 'mount slurmdbd configuration via S3' do
command "mount-s3 --allow-delete --uid $(id -u slurm) --gid $(id -g slurm) --dir-mode 0755 --file-mode 0600 #{node['slurmdbd_conf_bucket']} /opt/slurm/etc/"
user 'root'
file "#{node['cluster']['slurm']['install_dir']}/etc/#{config_file}" do
mode '0600'
owner node['cluster']['slurm']['user']
group node['cluster']['slurm']['group']
end
end

0 comments on commit 0f8a2c1

Please sign in to comment.