class OodCore::Job::Info
An object that describes a submitted job
Attributes
The account the job is charged against @return [String, nil] accounting id
Set of machines that is utilized for job execution @return [Array<NodeInfo>] allocated nodes
The accumulated CPU time in seconds @return [Integer, nil] cpu time
The time the job first entered a “Started” state @return [Time, nil] dispatch time
The identifier of the job @return [String] job id
Name of the job @return [String, nil] job name
Owner of job @return [String, nil] job owner
Native resource manager output for job info @note Should not be used by generic apps @return [Object] native info
Number of procs allocated for job @return [Integer, nil] allocated total number of procs
Name of the queue in which the job was queued or started @return [String, nil] queue name
The status of the job @return [Status] job state
The time at which the job was submitted @return [Time, nil] submission time
Name of the submission host for this job @return [String, nil] submit host
List of job array child task statuses @note only relevant for job arrays @return [Array<Task>] tasks
The total wall clock time limit in seconds @return [Integer, nil] wallclock time limit
The accumulated wall clock time in seconds @return [Integer, nil] wallclock time
Public Class Methods
@param id [#to_s] job id @param status [#to_sym] job state @param allocated_nodes
[Array<#to_h>] allocated nodes @param submit_host
[#to_s, nil] submit host @param job_name
[#to_s, nil] job name @param job_owner
[#to_s, nil] job owner @param accounting_id
[#to_s, nil] accounting id @param procs [#to_i, nil] allocated total number of procs @param queue_name
[#to_s, nil] queue name @param wallclock_time
[#to_i, nil] wallclock time @param wallclock_limit
[#to_i, nil] wallclock time limit @param cpu_time
[#to_i, nil] cpu time @param submission_time
[#to_i, nil] submission time @param dispatch_time
[#to_i, nil] dispatch time @param tasks [Array<Hash>] tasks e.g. { id: '12345.owens-batch', status: :running } @param native [Object] native info
# File lib/ood_core/job/info.rb, line 89 def initialize(id:, status:, allocated_nodes: [], submit_host: nil, job_name: nil, job_owner: nil, accounting_id: nil, procs: nil, queue_name: nil, wallclock_time: nil, wallclock_limit: nil, cpu_time: nil, submission_time: nil, dispatch_time: nil, native: nil, tasks: [], **_) @id = id.to_s @status = Status.new(state: status.to_sym) @allocated_nodes = allocated_nodes.map { |n| NodeInfo.new(n.to_h) } @submit_host = submit_host && submit_host.to_s @job_name = job_name && job_name.to_s @job_owner = job_owner && job_owner.to_s @accounting_id = accounting_id && accounting_id.to_s @procs = procs && procs.to_i @queue_name = queue_name && queue_name.to_s @wallclock_time = wallclock_time && wallclock_time.to_i @wallclock_limit = wallclock_limit && wallclock_limit.to_i @cpu_time = cpu_time && cpu_time.to_i @submission_time = submission_time && Time.at(submission_time.to_i) @dispatch_time = dispatch_time && Time.at(dispatch_time.to_i) @tasks = tasks.map {|task_status| Task.new(**task_status)} @status = job_array_aggregate_status unless @tasks.empty? @native = native end
Public Instance Methods
The comparison operator @param other [#to_h] object to compare against @return [Boolean] whether objects are equivalent
# File lib/ood_core/job/info.rb, line 157 def ==(other) to_h == other.to_h end
Create a new Info
for a child task @return [Info] merging the parent and the child task
# File lib/ood_core/job/info.rb, line 118 def build_child_info(task) parent_only_keys = [ :allocated_nodes, :procs, :cpu_time, :dispatch_time, :native, :tasks ] new(**to_h.merge(task.to_h).delete_if{|k, v| parent_only_keys.include?(k)}) end
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/info.rb, line 164 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/info.rb, line 170 def hash [self.class, to_h].hash end
Convert object to hash @return [Hash] object as hash
# File lib/ood_core/job/info.rb, line 133 def to_h { id: id, status: status, allocated_nodes: allocated_nodes, submit_host: submit_host, job_name: job_name, job_owner: job_owner, accounting_id: accounting_id, procs: procs, queue_name: queue_name, wallclock_time: wallclock_time, wallclock_limit: wallclock_limit, cpu_time: cpu_time, submission_time: submission_time, dispatch_time: dispatch_time, native: native, tasks: tasks } end
Private Instance Methods
Generate an aggregate status from child tasks @return [OodCore::Job::Status]
# File lib/ood_core/job/info.rb, line 178 def job_array_aggregate_status @tasks.map { |task_status| task_status.status }.max end