Skip to content

Commit a8d6227

Browse files
himani2411Himani Anil Deshpande
andauthored
Revert "Upgrade python version to 3.12 for all OSs except AL2" (#2886)
* Revert "[Test] Fix Python version in kitchen tests related to AWS Batch and CFN Boostrap scripts. In particular, we expect all Oses to use Python 3.12.8, except for AL2 which uses 3.9.20." This reverts commit 4574ee5. * Revert "Upgrade python version to 3.12 for all OSs except AL2 and remove unneccesary python dep installation (#2869)" This reverts commit 45431e6. --------- Co-authored-by: Himani Anil Deshpande <[email protected]>
1 parent 4574ee5 commit a8d6227

File tree

12 files changed

+85
-24
lines changed

12 files changed

+85
-24
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ 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).
1312
- On Ubuntu 22.04, install the Nvidia driver with the same compiler version used to compile the kernel.
1413
- Upgrade `aws-cfn-bootstrap` to version 2.0-32.
1514
- Upgrade amazon-efs-utils to version 2.1.0.

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/test/controls/awsbatch_virtualenv_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
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'
1213
base_dir = "/opt/parallelcluster"
1314
pyenv_dir = "#{base_dir}/pyenv"
1415

1516
control 'tag:install_awsbatch_virtualenv_created' do
16-
python_version = os_properties.alinux2? ? '3.9.20' : '3.12.8'
1717
title "awsbatch virtualenv should be created on #{python_version}"
1818
only_if { !os_properties.redhat? }
1919

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.12.8
34+
python-version: 3.9.20
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: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@
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
2241

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

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

Lines changed: 21 additions & 1 deletion
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 = node['cluster']['python-version']
18+
python_version = '3.9.20'
1919
virtualenv_path = "#{pyenv_root}/versions/#{python_version}/envs/#{virtualenv_name}"
2020

2121
node.default['cluster']['cfn_bootstrap_virtualenv_path'] = virtualenv_path
@@ -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-32'
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: 9 additions & 1 deletion
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) { "#{node['cluster']['python-version']}" }
8+
cached(:python_version) { '3.9.20' }
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,6 +32,14 @@
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+
3543
it 'sets virtualenv path' do
3644
expect(node.default['cluster']['cfn_bootstrap_virtualenv_path']).to eq(virtualenv_path)
3745
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,11 +9,11 @@
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'
1213
base_dir = "/opt/parallelcluster"
1314
pyenv_dir = "#{base_dir}/pyenv"
1415

1516
control 'tag:install_cfnbootstrap_virtualenv_created' do
16-
cfn_python_version = os_properties.alinux2? ? '3.9.20' : '3.12.8'
1717
title "cfnbootstrap virtualenv should be created on #{cfn_python_version}"
1818
only_if { !os_properties.redhat_on_docker? }
1919

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

Lines changed: 8 additions & 5 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://awscli.#{aws_domain}/awscli-exe-linux-#{node['kernel']['machine']}.zip"
23+
awscli_url = "https://s3.amazonaws.com/aws-cli/awscli-bundle.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,11 +42,10 @@
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-
4945
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
5049

5150
cookbook_file "#{node['cluster']['scripts_dir']}/iso-ca-bundle-config.sh" do
5251
source 'isolated/iso-ca-bundle-config.sh'
@@ -60,4 +59,8 @@
6059
execute "patch ca bundle" do
6160
command "sh #{node['cluster']['scripts_dir']}/iso-ca-bundle-config.sh"
6261
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
6366
end

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
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
1915

2016
node.default['cluster']['cookbook_virtualenv_path'] = virtualenv_path
2117
node_attributes "dump node attributes"
@@ -32,7 +28,7 @@
3228
end
3329

3430
remote_file "#{node['cluster']['base_dir']}/cookbook-dependencies.tgz" do
35-
source pypi_s3_uri
31+
source "#{node['cluster']['artifacts_s3_url']}/dependencies/PyPi/#{node['kernel']['machine']}/cookbook-dependencies.tgz"
3632
mode '0644'
3733
retries 3
3834
retry_delay 5

0 commit comments

Comments
 (0)