Skip to content

Commit 45431e6

Browse files
authored
Upgrade python version to 3.12 for all OSs except AL2 and remove unneccesary python dep installation (#2869)
1 parent bb01db6 commit 45431e6

File tree

12 files changed

+24
-85
lines changed

12 files changed

+24
-85
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This file is used to list changes made in each version of the AWS ParallelCluste
99
- Add support for Ubuntu24.
1010

1111
**CHANGES**
12+
- Upgrade Python to 3.12.8 for all OSs except AL2 (from 3.9.20).
1213
- On Ubuntu 22.04, install the Nvidia driver with the same compiler version used to compile the kernel.
1314
- Upgrade `aws-cfn-bootstrap` to version 2.0-32.
1415
- Upgrade amazon-efs-utils to version 2.1.0.

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,5 @@
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-
5131
node.default['cluster']['awsbatch_virtualenv_path'] = virtualenv_path
5232
node_attributes "dump node attributes"

cookbooks/aws-parallelcluster-awsbatch/test/controls/awsbatch_virtualenv_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
1010
# See the License for the specific language governing permissions and limitations under the License.
1111

12-
python_version = '3.9.20'
12+
python_version = '3.12.8'
1313
base_dir = "/opt/parallelcluster"
1414
pyenv_dir = "#{base_dir}/pyenv"
1515

cookbooks/aws-parallelcluster-computefleet/kitchen.computefleet-config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ suites:
3131
attributes:
3232
cluster:
3333
custom_node_package: https://github.com/aws/aws-parallelcluster-node/archive/develop.tar.gz
34-
python-version: 3.9.20
34+
python-version: 3.12.8
3535
node_virtualenv_path: /opt/parallelcluster/pyenv/versions/node_virtualenv
3636
- name: fleet_status
3737
run_list:

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,6 @@
1919

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.
22-
remote_file "#{node['cluster']['base_dir']}/node-dependencies.tgz" do
23-
source "#{node['cluster']['artifacts_s3_url']}/dependencies/PyPi/#{node['kernel']['machine']}/node-dependencies.tgz"
24-
mode '0644'
25-
retries 3
26-
retry_delay 5
27-
action :create_if_missing
28-
end
29-
30-
bash 'pip install' do
31-
user 'root'
32-
group 'root'
33-
cwd "#{node['cluster']['base_dir']}"
34-
code <<-REQ
35-
set -e
36-
tar xzf node-dependencies.tgz
37-
cd node
38-
#{node_virtualenv_path}/bin/pip install * -f ./ --no-index
39-
REQ
40-
end
4122

4223
bash "install custom aws-parallelcluster-node" do
4324
cwd Chef::Config[:file_cache_path]

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

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
virtualenv_name = 'cfn_bootstrap_virtualenv'
1616
pyenv_root = node['cluster']['system_pyenv_root']
1717
# FIXME: Python Version cfn_bootstrap_virtualenv due to a bug with cfn-hup
18-
python_version = '3.9.20'
18+
python_version = node['cluster']['python-version']
1919
virtualenv_path = "#{pyenv_root}/versions/#{python_version}/envs/#{virtualenv_name}"
2020

2121
node.default['cluster']['cfn_bootstrap_virtualenv_path'] = virtualenv_path
@@ -33,26 +33,6 @@
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-
5636
cfnbootstrap_version = '2.0-32'
5737
cfnbootstrap_package = "aws-cfn-bootstrap-py3-#{cfnbootstrap_version}.tar.gz"
5838

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
context "on #{platform}#{version}" do
66
cached(:cfnbootstrap_version) { '2.0-32' }
77
cached(:cfnbootstrap_package) { "aws-cfn-bootstrap-py3-#{cfnbootstrap_version}.tar.gz" }
8-
cached(:python_version) { '3.9.20' }
8+
cached(:python_version) { "#{node['cluster']['python-version']}" }
99
cached(:system_pyenv_root) { 'system_pyenv_root' }
1010
cached(:virtualenv_path) { "system_pyenv_root/versions/#{python_version}/envs/cfn_bootstrap_virtualenv" }
1111
cached(:timeout) { 1800 }
@@ -32,14 +32,6 @@
3232
)
3333
end
3434

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

cookbooks/aws-parallelcluster-environment/test/controls/cfn_bootstrap_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
1010
# See the License for the specific language governing permissions and limitations under the License.
1111

12-
cfn_python_version = '3.9.20'
12+
cfn_python_version = '3.12.8'
1313
base_dir = "/opt/parallelcluster"
1414
pyenv_dir = "#{base_dir}/pyenv"
1515

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
file_cache_path = Chef::Config[:file_cache_path]
2222
region = aws_region
23-
awscli_url = "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip"
23+
awscli_url = "https://awscli.#{aws_domain}/awscli-exe-linux-#{node['kernel']['machine']}.zip"
2424

2525
if region.start_with?("us-iso-")
2626
awscli_url = "https://aws-sdk-common-infra-dca-prod-deployment-bucket.s3.#{aws_region}.#{aws_domain}/aws-cli-v2/linux/x86_64/awscli-exe-linux-x86_64.zip"
@@ -42,10 +42,11 @@
4242
overwrite true
4343
end
4444

45+
bash 'install awscli' do
46+
code "#{file_cache_path}/awscli/aws/install -i /usr/local/aws -b /usr/local/bin"
47+
end
48+
4549
if region.start_with?("us-iso")
46-
bash 'install awscli' do
47-
code "#{file_cache_path}/awscli/aws/install -i /usr/local/aws -b /usr/local/bin"
48-
end
4950

5051
cookbook_file "#{node['cluster']['scripts_dir']}/iso-ca-bundle-config.sh" do
5152
source 'isolated/iso-ca-bundle-config.sh'
@@ -59,8 +60,4 @@
5960
execute "patch ca bundle" do
6061
command "sh #{node['cluster']['scripts_dir']}/iso-ca-bundle-config.sh"
6162
end
62-
else
63-
bash 'install awscli' do
64-
code "#{cookbook_virtualenv_path}/bin/python #{file_cache_path}/awscli/awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws"
65-
end
6663
end

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
# limitations under the License.
1313

1414
virtualenv_path = cookbook_virtualenv_path
15+
pypi_s3_uri = "#{node['cluster']['artifacts_s3_url']}/dependencies/PyPi/pypi-dependencies-#{node['cluster']['python-major-minor-version']}-#{node['kernel']['machine']}.tgz"
16+
if platform?('amazon') && node['platform_version'] == "2"
17+
pypi_s3_uri = "#{node['cluster']['artifacts_s3_url']}/dependencies/PyPi/#{node['kernel']['machine']}/cookbook-dependencies.tgz"
18+
end
1519

1620
node.default['cluster']['cookbook_virtualenv_path'] = virtualenv_path
1721
node_attributes "dump node attributes"
@@ -28,7 +32,7 @@
2832
end
2933

3034
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"
35+
source pypi_s3_uri
3236
mode '0644'
3337
retries 3
3438
retry_delay 5

0 commit comments

Comments
 (0)