class OodReservations::Reservation::Node
Object that describes a reserved node on a generic batch server FIXME: This should be generalized in some other gem
Attributes
The id of the node @return [String] id of node
A list of jobs running on this node @return [Array<String>] list of jobs running on node
The number of cores on this node @return [Fixnum] number of cores
The number of cores used on this node @return [Fixnum] number of cores used
A list of properties describing this node @return [Array<Symbol>] list of properties
Public Class Methods
@param id [#to_s] id of node @param ppn [#to_i] number of cores @param ppn_used
[#to_i] number of used cores @param props [Array<#to_sym>] list of properties of node @param jobs [Array<#to_s>] list of jobs on node
# File lib/ood_reservations/reservation.rb, line 123 def initialize(id:, ppn:, ppn_used:, props:, jobs:) @id = id.to_s @ppn = ppn.to_i @ppn_used = ppn_used.to_i @props = props.map(&:to_sym) @jobs = jobs.map(&:to_s) end
Public Instance Methods
The comparison operator for sorting values @param other [#to_s] object to compare against @return [Boolean] how objects compare
# File lib/ood_reservations/reservation.rb, line 146 def <=>(other) to_s <=> other.to_s end
Check whether objects are identical to each other @param other [#to_h] object to compare against @return [Boolean] whether objects are identical
# File lib/ood_reservations/reservation.rb, line 153 def eql?(other) self.class == other.class && self == other end
Generate a hash value for this object @return [Fixnum] hash value of object
# File lib/ood_reservations/reservation.rb, line 159 def hash [self.class, to_s].hash end
Is this node free to be used? @return [Boolean] free to use?
# File lib/ood_reservations/reservation.rb, line 133 def is_free? ppn_used == 0 end
Convert object to string @return [String] the string describing this object
# File lib/ood_reservations/reservation.rb, line 139 def to_s id end