Skip to content

Commit a77217b

Browse files
[BuildImage] Download build image dependencies from s3 bucket (#2761)
* Retrieve dependencies from s3 bucket rather than from the open-internet * Modify spec test to expect dependencies to be retrieved from an s3 bucket * Get python dependency using https rather than aws cli * Point s3 url for dependency download to production bucket * Fix fabric manager install to install from a local package * Update changelog to include changes to build-image --------- Co-authored-by: Hanwen <68928867+hanwen-pcluste@users.noreply.github.com>
1 parent 0079b13 commit a77217b

File tree

51 files changed

+410
-211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+410
-211
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This file is used to list changes made in each version of the AWS ParallelCluste
88

99
**ENHANCEMENTS**
1010
- Add support for external Slurmdbd.
11+
- Allow build-image to be run in an isolated network.
1112

1213
**CHANGES**
1314
- Upgrade Cinc Client to version to 18.4.12 from 18.2.7.

cookbooks/aws-parallelcluster-awsbatch/recipes/awsbatch_virtualenv.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,25 @@
2828
not_if { ::File.exist?("#{virtualenv_path}/bin/activate") }
2929
end
3030

31+
remote_file "#{node['cluster']['base_dir']}/awsbatch-dependencies.tgz" do
32+
source "#{node['cluster']['artifacts_s3_url']}/dependencies/PyPi/#{node['kernel']['machine']}/awsbatch-dependencies.tgz"
33+
mode '0644'
34+
retries 3
35+
retry_delay 5
36+
action :create_if_missing
37+
end
38+
39+
bash 'pip install' do
40+
user 'root'
41+
group 'root'
42+
cwd "#{node['cluster']['base_dir']}"
43+
code <<-REQ
44+
set -e
45+
tar xzf awsbatch-dependencies.tgz
46+
cd awsbatch
47+
#{virtualenv_path}/bin/pip install * -f ./ --no-index
48+
REQ
49+
end
50+
3151
node.default['cluster']['awsbatch_virtualenv_path'] = virtualenv_path
3252
node_attributes "dump node attributes"

cookbooks/aws-parallelcluster-awsbatch/recipes/install.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
mkdir aws-parallelcluster-awsbatch-cli
4444
tar -xzf aws-parallelcluster.tgz --directory aws-parallelcluster-awsbatch-cli
4545
cd aws-parallelcluster-awsbatch-cli/*aws-parallelcluster-*
46+
4647
#{node['cluster']['awsbatch_virtualenv_path']}/bin/pip install awsbatch-cli/
4748
CLI
4849
end

cookbooks/aws-parallelcluster-computefleet/recipes/install/custom_parallelcluster_node.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
# TODO: once the pyenv Chef resource supports installing packages from a path (e.g. `pip install .`), convert the
2121
# bash block to a recipe that uses the pyenv resource.
2222

23+
remote_file "#{Chef::Config[:file_cache_path]}/node-dependencies.tgz" do
24+
source "#{node['cluster']['artifacts_s3_url']}/dependencies/PyPi/#{node['kernel']['machine']}/node-dependencies.tgz"
25+
mode '0644'
26+
retries 3
27+
retry_delay 5
28+
action :create_if_missing
29+
end
30+
2331
bash "install custom aws-parallelcluster-node" do
2432
cwd Chef::Config[:file_cache_path]
2533
code <<-NODE

cookbooks/aws-parallelcluster-computefleet/recipes/install/parallelcluster_node.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
if is_custom_node?
3737
include_recipe 'aws-parallelcluster-computefleet::custom_parallelcluster_node'
3838
else
39-
pyenv_pip 'aws-parallelcluster-node' do
40-
version node['cluster']['parallelcluster-node-version']
41-
virtualenv virtualenv_path
39+
execute "install official aws-parallelcluster-node" do
40+
command "#{virtualenv_path}/bin/pip install aws-parallelcluster-node==#{node['cluster']['parallelcluster-node-version']}"
4241
end
4342
end

cookbooks/aws-parallelcluster-computefleet/spec/unit/recipes/node_spec.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@
3636
end
3737

3838
it 'installs official node package' do
39-
is_expected.to install_pyenv_pip('aws-parallelcluster-node').with(
40-
version: node_version,
41-
virtualenv: virtualenv_path
42-
)
39+
is_expected.to run_execute('install official aws-parallelcluster-node')
4340
end
4441
end
4542

cookbooks/aws-parallelcluster-environment/recipes/install/cfn_bootstrap.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,26 @@
3333
not_if { ::File.exist?("#{virtualenv_path}/bin/activate") }
3434
end
3535

36+
remote_file "#{node['cluster']['base_dir']}/cfn-dependencies.tgz" do
37+
source "#{node['cluster']['artifacts_s3_url']}/dependencies/PyPi/#{node['kernel']['machine']}/cfn-dependencies.tgz"
38+
mode '0644'
39+
retries 3
40+
retry_delay 5
41+
action :create_if_missing
42+
end
43+
44+
bash 'pip install' do
45+
user 'root'
46+
group 'root'
47+
cwd "#{node['cluster']['base_dir']}"
48+
code <<-REQ
49+
set -e
50+
tar xzf cfn-dependencies.tgz
51+
cd cfn
52+
#{virtualenv_path}/bin/pip install * -f ./ --no-index
53+
REQ
54+
end
55+
3656
cfnbootstrap_version = '2.0-28'
3757
cfnbootstrap_package = "aws-cfn-bootstrap-py3-#{cfnbootstrap_version}.tar.gz"
3858

cookbooks/aws-parallelcluster-environment/spec/unit/recipes/cfn_bootstrap_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@
3030
)
3131
end
3232

33+
it 'installs python packages' do
34+
is_expected.to run_bash("pip install").with(
35+
user: 'root',
36+
group: 'root',
37+
cwd: "#{node['cluster']['base_dir']}"
38+
)
39+
end
40+
3341
it 'sets virtualenv path' do
3442
expect(node.default['cluster']['cfn_bootstrap_virtualenv_path']).to eq(virtualenv_path)
3543
is_expected.to write_node_attributes('dump node attributes')

cookbooks/aws-parallelcluster-platform/recipes/install/cookbook_virtualenv.rb

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@
2424
activate_virtual_env cookbook_virtualenv_name do
2525
pyenv_path cookbook_virtualenv_path
2626
python_version cookbook_python_version
27-
requirements_path "cookbook_virtualenv/requirements.txt"
2827
not_if { ::File.exist?("#{cookbook_virtualenv_path}/bin/activate") }
2928
end
29+
30+
remote_file "#{node['cluster']['base_dir']}/cookbook-dependencies.tgz" do
31+
source "#{node['cluster']['artifacts_s3_url']}/dependencies/PyPi/#{node['kernel']['machine']}/cookbook-dependencies.tgz"
32+
mode '0644'
33+
retries 3
34+
retry_delay 5
35+
action :create_if_missing
36+
end
37+
38+
bash 'pip install' do
39+
user 'root'
40+
group 'root'
41+
cwd "#{node['cluster']['base_dir']}"
42+
code <<-REQ
43+
set -e
44+
tar xzf cookbook-dependencies.tgz
45+
cd dependencies
46+
#{virtualenv_path}/bin/pip install * -f ./ --no-index
47+
REQ
48+
end

cookbooks/aws-parallelcluster-platform/recipes/install/cuda.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
cuda_complete_version = "#{cuda_version}.#{cuda_patch}"
2525
cuda_version_suffix = '535.104.05'
2626
cuda_arch = arm_instance? ? 'linux_sbsa' : 'linux'
27-
cuda_url = "https://developer.download.nvidia.com/compute/cuda/#{cuda_complete_version}/local_installers/cuda_#{cuda_complete_version}_#{cuda_version_suffix}_#{cuda_arch}.run"
27+
cuda_url = "#{node['cluster']['artifacts_s3_url']}/dependencies/cuda/cuda_#{cuda_complete_version}_#{cuda_version_suffix}_#{cuda_arch}.run"
2828
cuda_samples_version = '12.2'
29-
cuda_samples_url = "https://github.com/NVIDIA/cuda-samples/archive/refs/tags/v#{cuda_samples_version}.tar.gz"
29+
cuda_samples_url = "#{node['cluster']['artifacts_s3_url']}/dependencies/cuda/samples/v#{cuda_samples_version}.tar.gz"
3030
tmp_cuda_run = '/tmp/cuda.run'
3131
tmp_cuda_sample_archive = '/tmp/cuda-sample.tar.gz'
3232

0 commit comments

Comments
 (0)