Method: OodCore::Job::Adapters::Slurm::Batch#nodes

Defined in:
lib/ood_core/job/adapters/slurm.rb

#nodesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/ood_core/job/adapters/slurm.rb', line 404

def nodes
  args = all_sinfo_node_fields.values.join(UNIT_SEPARATOR)
  output = call('sinfo', '-ho', "#{RECORD_SEPARATOR}#{args}")

  output.each_line(RECORD_SEPARATOR).map do |line|
    values = line.chomp(RECORD_SEPARATOR).strip.split(UNIT_SEPARATOR)

    next if values.empty?

    data = Hash[all_sinfo_node_fields.keys.zip(values)]
    data[:name] = data[:name].to_s.split(',').first
    data[:features] = data[:features].to_s.split(',')
    NodeInfo.new(**data)
  end.compact
end