Skip to content

Commit 13a71b4

Browse files
himani2411Himani Deshpande
andauthored
Timing out cfn-hup if it hangs (#2807)
Co-authored-by: Himani Deshpande <[email protected]>
1 parent 34b4b9d commit 13a71b4

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,6 @@
9898
owner 'root'
9999
group 'root'
100100
mode '0744'
101-
variables(cfn_bootstrap_virtualenv_path: virtualenv_path)
101+
variables(cfn_bootstrap_virtualenv_path: virtualenv_path,
102+
node_bootstrap_timeout: node['cluster']['compute_node_bootstrap_timeout'] || node['cluster']['Timeout'])
102103
end

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
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" }
11+
cached(:timeout) { 1800 }
1112

1213
context "when cfn_bootstrap virtualenv not installed yet" do
1314
cached(:chef_run) do
1415
runner = runner(platform: platform, version: version) do |node|
1516
node.override['cluster']['system_pyenv_root'] = system_pyenv_root
1617
node.override['cluster']['region'] = 'non_china'
18+
node.override['cluster']['compute_node_bootstrap_timeout'] = timeout
1719
end
1820
runner.converge(described_recipe)
1921
end
@@ -79,7 +81,7 @@
7981
owner: 'root',
8082
group: 'root',
8183
mode: '0744',
82-
variables: { cfn_bootstrap_virtualenv_path: virtualenv_path }
84+
variables: { cfn_bootstrap_virtualenv_path: virtualenv_path, node_bootstrap_timeout: timeout }
8385
)
8486
end
8587
end
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -ex
2+
set -x
33

44
# This script is used to run cfn-hup is a way that is suitable to be managed by supervisord.
55
# In particular, cfn-hup is executed in no-daemon mode.
@@ -9,6 +9,6 @@ set -ex
99
[ -f /etc/profile.d/proxy.sh ] && . /etc/profile.d/proxy.sh
1010

1111
while true; do
12-
<%= @cfn_bootstrap_virtualenv_path %>/bin/cfn-hup --no-daemon --verbose
12+
timeout <%= @node_bootstrap_timeout %> <%= @cfn_bootstrap_virtualenv_path %>/bin/cfn-hup --no-daemon --verbose
1313
sleep 60
1414
done

0 commit comments

Comments
 (0)