class OodCore::Job::Status
An object that describes the current state of a submitted job
Attributes
Current status of submitted job @return [Symbol] status of job
Public Class Methods
@param state [#to_sym] status of job @raise [UnknownStateAttribute] if supplied state does not exist
# File lib/ood_core/job/status.rb, line 45 def initialize(state:, **_) @state = state.to_sym raise UnknownStateAttribute, "arguments specify unknown '#{@state}' state" unless self.class.states.include?(@state) end
Possible states a submitted job can be in:
# Job status cannot be determined :undetermined # Job is queued for being scheduled and executed :queued # Job has been placed on hold by the system, the administrator, or # submitting user :queued_held # Job is running on an execution host :running # Job has been suspended by the user, the system, or the administrator :suspended # Job is completed and not running on an execution host :completed @note that this list's order is meaningful and should not be sorted lexigraphically
# File lib/ood_core/job/status.rb, line 27 def states %i( undetermined completed queued_held queued running suspended ) end
Public Instance Methods
The comparison operator for sorting values.
@return [Integer] Comparison value based on precedence
# File lib/ood_core/job/status.rb, line 126 def <=>(other) precedence <=> other.precedence end
The comparison operator @param other [#to_sym] object to compare against @return [Boolean] whether objects are equivalent
# File lib/ood_core/job/status.rb, line 65 def ==(other) to_sym == other.to_sym end
Whether objects are identical to each other @param other [#to_sym] object to compare against @return [Boolean] whether objects are identical
# File lib/ood_core/job/status.rb, line 72 def eql?(other) self.class == other.class && self == other end
Generate a hash value for this object @return [Integer] hash value of object
# File lib/ood_core/job/status.rb, line 78 def hash [self.class, to_sym].hash end
# File lib/ood_core/job/status.rb, line 119 def precedence self.class.states.index(@state) end
Convert object to string @return [String] object as string
# File lib/ood_core/job/status.rb, line 58 def to_s state.to_s end
Convert object to symbol @return [Symbol] object as symbol
# File lib/ood_core/job/status.rb, line 52 def to_sym state end