Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move files out of /tmp #2888

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def cidr_to_netmask(cidr)

cookbook_file 'configure_nw_interface.sh' do
source 'network_interfaces/configure_nw_interface.sh'
path '/tmp/configure_nw_interface.sh'
path "#{node['cluster']['tmp_dir']}/configure_nw_interface.sh"
user 'root'
group 'root'
mode '0644'
Expand All @@ -87,7 +87,7 @@ def cidr_to_netmask(cidr)
execute 'configure_nw_interface' do
user 'root'
group 'root'
cwd "/tmp"
cwd node['cluster']['tmp_dir']
environment(
# TODO: The variables are a superset of what's required by individual scripts. Consider simplification.
'DEVICE_NAME' => device_name,
Expand All @@ -101,7 +101,7 @@ def cidr_to_netmask(cidr)
'MAC' => mac
)

command 'sh /tmp/configure_nw_interface.sh'
command "sh #{node['cluster']['tmp_dir']}/configure_nw_interface.sh"
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
bucket = "s3.#{aws_region}.#{aws_domain}"
end

remote_file "/tmp/#{cfnbootstrap_package}" do
remote_file "#{node['cluster']['tmp_dir']}/#{cfnbootstrap_package}" do
source "https://#{bucket}/cloudformation-examples/#{cfnbootstrap_package}"
retries 3
retry_delay 5
Expand All @@ -74,7 +74,7 @@
bash "Install CloudFormation helpers from #{cfnbootstrap_package}" do
user 'root'
group 'root'
cwd '/tmp'
cwd node['cluster']['tmp_dir']
code "#{virtualenv_path}/bin/pip install #{cfnbootstrap_package}"
creates "#{virtualenv_path}/bin/cfn-hup"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
end

it 'downloads cfn_bootstrap package from s3' do
is_expected.to create_remote_file("/tmp/#{cfnbootstrap_package}").with(
is_expected.to create_remote_file("#{node['cluster']['tmp_dir']}/#{cfnbootstrap_package}").with(
source: "https://s3.amazonaws.com/cloudformation-examples/#{cfnbootstrap_package}"
)
end
Expand All @@ -55,7 +55,7 @@
is_expected.to run_bash("Install CloudFormation helpers from #{cfnbootstrap_package}").with(
user: 'root',
group: 'root',
cwd: '/tmp',
cwd: node['cluster']['tmp_dir'],
code: "#{virtualenv_path}/bin/pip install #{cfnbootstrap_package}",
creates: "#{virtualenv_path}/bin/cfn-hup"
)
Expand Down Expand Up @@ -111,7 +111,7 @@
runner.converge(described_recipe)
end
it 'downloads cfn_bootstrap package from a different s3 bucket' do
is_expected.to create_remote_file("/tmp/#{cfnbootstrap_package}").with(
is_expected.to create_remote_file("#{node['cluster']['tmp_dir']}/#{cfnbootstrap_package}").with(
source: "https://s3.cn-north-1.amazonaws.com.cn/cn-north-1-aws-parallelcluster/cloudformation-examples/#{cfnbootstrap_package}"
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
control 'network_interfaces_configuration_script_created' do
title 'Check script to configure network interface is created'

describe file('/tmp/configure_nw_interface.sh') do
describe file("#{node['cluster']['tmp_dir']}/configure_nw_interface.sh") do
it { should exist }
its('mode') { should cmp '0644' }
its('owner') { should eq 'root' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
cloud-init clean -s

rm -rf /var/tmp/* /tmp/*
rm -rf node['cluster']['tmp_dir']
rm -rf /etc/ssh/ssh_host_*
rm -f /etc/udev/rules.d/70-persistent-net.rules
grep -l "Created by cloud-init on instance boot automatically" /etc/sysconfig/network-scripts/ifcfg-* | xargs rm -f
Expand Down
14 changes: 7 additions & 7 deletions cookbooks/aws-parallelcluster-platform/recipes/install/cuda.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
cuda_url = "#{node['cluster']['artifacts_s3_url']}/dependencies/cuda/cuda_#{cuda_complete_version}_#{cuda_version_suffix}_#{cuda_arch}.run"
cuda_samples_version = '12.4'
cuda_samples_url = "#{node['cluster']['artifacts_s3_url']}/dependencies/cuda/samples/v#{cuda_samples_version}.tar.gz"
tmp_cuda_run = '/tmp/cuda.run'
tmp_cuda_sample_archive = '/tmp/cuda-sample.tar.gz'
tmp_cuda_run = "#{node['cluster']['tmp_dir']}/cuda.run"
tmp_cuda_sample_archive = "#{node['cluster']['tmp_dir']}/cuda-sample.tar.gz"

node.default['cluster']['nvidia']['cuda']['version'] = cuda_version
node.default['cluster']['nvidia']['cuda_samples_version'] = cuda_samples_version
Expand All @@ -47,13 +47,13 @@
bash 'cuda.run advanced' do
user 'root'
group 'root'
cwd '/tmp'
cwd node['cluster']['tmp_dir']
code <<-CUDA
set -e
mkdir /cuda-install
./cuda.run --silent --toolkit --samples --tmpdir=/cuda-install
rm -rf /cuda-install
rm -f /tmp/cuda.run
rm -f #{node['cluster']['tmp_dir']}/cuda.run
CUDA
creates "/usr/local/cuda-#{cuda_version}"
end
Expand All @@ -71,11 +71,11 @@
bash 'cuda.sample install' do
user 'root'
group 'root'
cwd '/tmp'
cwd node['cluster']['tmp_dir']
code <<-CUDA
set -e
tar xf "/tmp/cuda-sample.tar.gz" --directory "/usr/local/"
rm -f "/tmp/cuda-sample.tar.gz"
tar xf "#{node['cluster']['tmp_dir']}/cuda-sample.tar.gz" --directory "/usr/local/"
rm -f "#{node['cluster']['tmp_dir']}/cuda-sample.tar.gz"
CUDA
creates "/usr/local/cuda-#{cuda_version}/samples"
end
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
directory node['cluster']['base_dir']
directory node['cluster']['sources_dir']
directory node['cluster']['scripts_dir']
directory node['cluster']['tmp_dir']
directory node['cluster']['license_dir']
directory node['cluster']['configs_dir']
directory node['cluster']['shared_dir']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

property :nvidia_driver_version, String

tmp_nvidia_run = '/tmp/nvidia.run'
tmp_nvidia_run = "#{node['cluster']['tmp_dir']}/nvidia.run"

action :setup do
return unless nvidia_driver_enabled?
Expand Down Expand Up @@ -76,11 +76,11 @@
bash 'nvidia.run advanced' do
user 'root'
group 'root'
cwd '/tmp'
cwd node['cluster']['tmp_dir']
code <<-NVIDIA
set -e
#{compiler_path} ./nvidia.run --silent --dkms --disable-nouveau -m=#{nvidia_kernel_module}
rm -f /tmp/nvidia.run
rm -f #{node['cluster']['tmp_dir']}/nvidia.run
NVIDIA
creates '/usr/bin/nvidia-smi'
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
end

it 'downloads CUDA run file' do
is_expected.to create_remote_file('/tmp/cuda.run').with(
is_expected.to create_remote_file("#{node['cluster']['tmp_dir']}/cuda.run").with(
source: cuda_url,
mode: '0755',
retries: 3,
Expand All @@ -53,16 +53,16 @@
.with(
user: 'root',
group: 'root',
cwd: '/tmp',
cwd: node['cluster']['tmp_dir'],
creates: "/usr/local/cuda-#{cuda_version}")
.with_code(%r{mkdir /cuda-install})
.with_code(%r{./cuda.run --silent --toolkit --samples --tmpdir=/cuda-install})
.with_code(%r{rm -rf /cuda-install})
.with_code(%r{rm -f /tmp/cuda.run})
.with_code(%r{rm -f #{node['cluster']['tmp_dir']}/cuda.run})
end

it 'downloads CUDA sample files' do
is_expected.to create_remote_file('/tmp/cuda-sample.tar.gz').with(
is_expected.to create_remote_file("#{node['cluster']['tmp_dir']}/cuda-sample.tar.gz").with(
source: cuda_samples_url,
mode: '0644',
retries: 3,
Expand All @@ -75,9 +75,9 @@
.with(
user: 'root',
group: 'root',
cwd: '/tmp')
.with_code(%r{tar xf "/tmp/cuda-sample.tar.gz" --directory "/usr/local/"})
.with_code(%r{rm -f "/tmp/cuda-sample.tar.gz"})
cwd: node['cluster']['tmp_dir'])
.with_code(%r{tar xf "#{node['cluster']['tmp_dir']}/cuda-sample.tar.gz" --directory "/usr/local/"})
.with_code(%r{rm -f "#{node['cluster']['tmp_dir']}/cuda-sample.tar.gz"})
end
end

Expand All @@ -95,7 +95,7 @@
cached(:node) { chef_run.node }

it 'downloads CUDA run file' do
is_expected.to create_remote_file('/tmp/cuda.run').with_source(cuda_url)
is_expected.to create_remote_file("#{node['cluster']['tmp_dir']}/cuda.run").with_source(cuda_url)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def self.setup(chef_run, nvidia_driver_version: nil)
end

it 'downloads nvidia driver' do
is_expected.to create_remote_file('/tmp/nvidia.run').with(
is_expected.to create_remote_file("#{node['cluster']['tmp_dir']}/nvidia.run").with(
source: nvidia_driver_url,
mode: '0755',
retries: 3,
Expand Down Expand Up @@ -241,11 +241,11 @@ def self.setup(chef_run, nvidia_driver_version: nil)
.with(
user: 'root',
group: 'root',
cwd: '/tmp',
cwd: node['cluster']['tmp_dir'],
creates: '/usr/bin/nvidia-smi'
)
.with_code(%r{CC=/usr/bin/gcc10-gcc ./nvidia.run --silent --dkms --disable-nouveau -m=#{kernel_module}})
.with_code(%r{rm -f /tmp/nvidia.run})
.with_code(%r{rm -f #{node['cluster']['tmp_dir']}/nvidia.run})
end
elsif platform == 'ubuntu' && version == '22.04'
it 'installs gcc' do
Expand All @@ -269,7 +269,7 @@ def self.setup(chef_run, nvidia_driver_version: nil)
.with(
user: 'root',
group: 'root',
cwd: '/tmp',
cwd: node['cluster']['tmp_dir'],
creates: '/usr/bin/nvidia-smi'
)
.with_code(%r{#{compiler_path} ./nvidia.run --silent --dkms --disable-nouveau -m=#{kernel_module}})
Expand All @@ -283,11 +283,11 @@ def self.setup(chef_run, nvidia_driver_version: nil)
.with(
user: 'root',
group: 'root',
cwd: '/tmp',
cwd: node['cluster']['tmp_dir'],
creates: '/usr/bin/nvidia-smi'
)
.with_code(%r{./nvidia.run --silent --dkms --disable-nouveau -m=#{kernel_module}})
.with_code(%r{rm -f /tmp/nvidia.run})
.with_code(%r{rm -f #{node['cluster']['tmp_dir']}/nvidia.run})
end
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
default['cluster']['base_dir'] = '/opt/parallelcluster'
default['cluster']['sources_dir'] = "#{node['cluster']['base_dir']}/sources"
default['cluster']['scripts_dir'] = "#{node['cluster']['base_dir']}/scripts"
default['cluster']['tmp_dir'] = "#{node['cluster']['base_dir']}/tmp"
default['cluster']['license_dir'] = "#{node['cluster']['base_dir']}/licenses"
default['cluster']['configs_dir'] = "#{node['cluster']['base_dir']}/configs"
default['cluster']['shared_dir'] = "#{node['cluster']['base_dir']}/shared"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
user 'root'
code <<-PYXIS_INSTALL
set -e
tar xf #{pyxis_tarball} -C /tmp
cd /tmp/pyxis-#{pyxis_version}
tar xf #{pyxis_tarball} -C #{node['cluster']['tmp_dir']}
cd #{node['cluster']['tmp_dir']}/pyxis-#{pyxis_version}
CPPFLAGS='-I #{node['cluster']['slurm']['install_dir']}/include/' make
CPPFLAGS='-I #{node['cluster']['slurm']['install_dir']}/include/' make install
PYXIS_INSTALL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def generate_munge_key
declare_resource(:bash, 'generate_munge_key') do
user node['cluster']['munge']['user']
group node['cluster']['munge']['group']
cwd '/tmp'
cwd node['cluster']['tmp_dir']
code <<-GENERATE_KEY
set -e
/usr/sbin/mungekey --verbose --force
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

action :setup do
mysql_archive_url = package_archive(node['cluster']['artifacts_s3_url'])
mysql_tar_file = "/tmp/#{package_filename}"
mysql_tar_file = "#{node['cluster']['tmp_dir']}/#{package_filename}"

log "Downloading MySQL packages archive from #{mysql_archive_url}"

Expand All @@ -33,7 +33,7 @@
bash 'Install MySQL packages' do
user 'root'
group 'root'
cwd '/tmp'
cwd node['cluster']['tmp_dir']
code <<-MYSQL
set -e

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
retry_delay: 5,
code: <<-CODE
set -e
tar xf #{cluster_sources_dir}/pyxis-#{pyxis_version}.tar.gz -C /tmp
cd /tmp/pyxis-#{pyxis_version}
tar xf #{cluster_sources_dir}/pyxis-#{pyxis_version}.tar.gz -C #{node['cluster']['tmp_dir']}
cd #{node['cluster']['tmp_dir']}/pyxis-#{pyxis_version}
CPPFLAGS='-I #{slurm_install_dir}/include/' make
CPPFLAGS='-I #{slurm_install_dir}/include/' make install
CODE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def self.validate(chef_run)
end
end
cached(:package_archive) { "#{s3_url}/mysql/#{package_platform}/#{package_filename}" }
cached(:tarfile) { "/tmp/mysql-community-client-#{package_version}.tar.gz" }
cached(:tarfile) { "#{node['cluster']['tmp_dir']}/mysql-community-client-#{package_version}.tar.gz" }
cached(:repository_packages) do
if platform == 'ubuntu'
if version.to_i == 18
Expand Down Expand Up @@ -87,7 +87,7 @@ def self.validate(chef_run)
is_expected.to run_bash('Install MySQL packages')
.with(user: 'root')
.with(group: 'root')
.with(cwd: '/tmp')
.with(cwd: node['cluster']['tmp_dir'])
.with(code: %{ set -e

EXTRACT_DIR=$(mktemp -d --tmpdir mysql.XXXXXXX)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
control 'custom_settings_file_retrieved' do
title 'Checks that customs settings file has been retrieved if specified in the config'

describe file("/tmp/custom_slurm_settings_include_file_slurm.conf") do
describe file("#{node['cluster']['tmp_dir']}/custom_slurm_settings_include_file_slurm.conf") do
it { should exist }
end
end
Loading