class OodCore::Job::NodeInfo

An object that describes the resources used on a specific node

Attributes

name[R]

The name of the host machine @return [String] node name

procs[R]

The number of procs reserved on the given machine @return [Integer, nil] number of procs

Public Class Methods

new(name:, procs: nil, **_) click to toggle source

@param name [#to_s] node name @param procs [#to_i, nil] number of procs

# File lib/ood_core/job/node_info.rb, line 15
def initialize(name:, procs: nil, **_)
  @name  = name.to_s
  @procs = procs && procs.to_i
end

Public Instance Methods

==(other) click to toggle source

The comparison operator @param other [#to_h] object to compare against @return [Boolean] whether objects are equivalent

# File lib/ood_core/job/node_info.rb, line 29
def ==(other)
  to_h == other.to_h
end
eql?(other) click to toggle source

Whether objects are identical to each other @param other [#to_h] object to compare against @return [Boolean] whether objects are identical

# File lib/ood_core/job/node_info.rb, line 36
def eql?(other)
  self.class == other.class && self == other
end
hash() click to toggle source

Generate a hash value for this object @return [Integer] hash value of object

# File lib/ood_core/job/node_info.rb, line 42
def hash
  [self.class, to_h].hash
end
to_h() click to toggle source

Convert object to hash @return [Hash] object as hash

# File lib/ood_core/job/node_info.rb, line 22
def to_h
  { name: name, procs: procs }
end