Skip to content

[Bug] Run static fleet checks only if there are static nodes #2960

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

Draft
wants to merge 2 commits 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
@@ -1,7 +1,16 @@
#!/bin/bash

sinfo_output=$(<%= node['cluster']['slurm']['install_dir'] %>/bin/sinfo -h -o '%N %t' | grep -v -E '(idle|alloc|mix|maint)$')
while IFS= read -r line; do
nodelist=$(echo "$line" | awk '{print $1}')
<%= node['cluster']['slurm']['install_dir'] %>/bin/scontrol show hostnames "$nodelist" | { grep -E '^[a-z0-9\-]+\-st\-[a-z0-9\-]+\-[0-9]+.*' || true; }
done <<< "$sinfo_output"


cluster_static_node_count=$1
if [[ -z "$cluster_static_node_count" ]]; then
cluster_static_node_count=1
fi

if [[ "$cluster_static_node_count" -ge "1" ]]; then
sinfo_output=$(<%= node['cluster']['slurm']['install_dir'] %>/bin/sinfo -h -o '%N %t' | grep -v -E '(idle|alloc|mix|maint)$')
while IFS= read -r line; do
nodelist=$(echo "$line" | awk '{print $1}')
<%= node['cluster']['slurm']['install_dir'] %>/bin/scontrol show hostnames "$nodelist" | { grep -E '^[a-z0-9\-]+\-st\-[a-z0-9\-]+\-[0-9]+.*' || true; }
done <<< "$sinfo_output"
fi
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,20 @@ include {{ output_dir }}/pcluster/slurm_parallelcluster_{{ queue.Name }}_partiti
{% endfor %}

{% if ns.has_static %}
{%- set ns.total_min_count = 0 %}
SuspendExcNodes=
{%- set ns.is_first = True %}
{%- for queue in queues %}
{% for compute_resource in queue.ComputeResources %}
{% if compute_resource.MinCount > 0 %}
{{- "," if not ns.is_first else "" -}}
{{ queue.Name }}-st-{{ compute_resource.Name }}-[1-{{ compute_resource.MinCount }}]
{%- set ns.total_min_count = ns.total_min_count + compute_resource.MinCount %}
{%- set ns.is_first = False %}
{%- endif %}
{% endfor %}
{% endfor %}

{% endif %}

#TOTAL_MIN_COUNT={{ ns.total_min_count }}
10 changes: 8 additions & 2 deletions cookbooks/aws-parallelcluster-slurm/libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ def wait_cluster_ready
end
end

def get_static_node_count
cmd = Mixlib::ShellOut.new("cat #{node['cluster']['slurm']['install_dir']}/etc/slurm_parallelcluster.conf | grep -o '#TOTAL_MIN_COUNT=\([0-9]*\)' | cut -d'=' -f2")
cmd.run_command.stdout.strip
end

def wait_static_fleet_running
ruby_block "wait for static fleet capacity" do
block do
Expand All @@ -203,12 +208,13 @@ def check_for_protected_mode(fleet_status_command) # rubocop:disable Lint/Nested
fleet_status_command = Shellwords.escape(
"/usr/local/bin/get-compute-fleet-status.sh"
)

# Example output for sinfo
# sinfo -h -o '%N %t'
# queue-0-dy-compute-resource-g4dn-0-[1-10],queue-1-dy-compute-resource-g4dn-1-[1-10] idle~
# queue-2-dy-compute-resource-g4dn-2-[1-10],queue-3-dy-compute-resource-g4dn-3-[1-10] idle
until shell_out!("/bin/bash -c /usr/local/bin/is_fleet_ready.sh").stdout.strip.empty?
check_for_protected_mode(fleet_status_command)
until shell_out!("/bin/bash -c /usr/local/bin/is_fleet_ready.sh #{get_static_node_count.to_i}").stdout.strip.empty?
check_for_protected_mode(fleet_status_command) #TODO Separate check for dynamic Nodes during dfsmv2

Chef::Log.info("Waiting for static fleet capacity provisioning")
sleep(15)
Expand Down
Loading