Skip to content

Commit 314f60f

Browse files
author
Himani Anil Deshpande
committed
Using Ruby yaml for looping to get count od static nodes
1 parent eff1587 commit 314f60f

File tree

1 file changed

+12
-2
lines changed
  • cookbooks/aws-parallelcluster-slurm/libraries

1 file changed

+12
-2
lines changed

cookbooks/aws-parallelcluster-slurm/libraries/helpers.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,18 @@ def wait_cluster_ready
179179
end
180180

181181
def get_static_node_count
182-
cmd = Mixlib::ShellOut.new("#{cookbook_virtualenv_path}/bin/python #{node['cluster']['scripts_dir']}/slurm/pcluster_fleet_config_generator.py --input-file #{node['cluster']['cluster_config_path']} --total-min-count | grep -o 'The total MinCount of cluster is =\([0-9]*\)' | cut -d'=' -f2")
183-
cmd.run_command.stdout.strip
182+
require 'yaml'
183+
cluster_config = YAML.safe_load(File.read(node['cluster']['cluster_config_path']))
184+
total_min_count = 0
185+
slurm_queues_section = cluster_config.dig("Scheduling", "SlurmQueues")
186+
if slurm_queues_section
187+
slurm_queues_section.each do |queue_config|
188+
queue_config.dig('ComputeResources').each do |compute_resource_config|
189+
total_min_count += compute_resource_config.dig('MinCount').to_i
190+
end
191+
end
192+
end
193+
total_min_count
184194
end
185195

186196
def wait_static_fleet_running

0 commit comments

Comments
 (0)