Class: OodCore::Job::Info
- Inherits:
- 
      Object
      
        - Object
- OodCore::Job::Info
 
- Defined in:
- lib/ood_core/job/info.rb
Overview
An object that describes a submitted job.
Direct Known Subclasses
Adapters::Coder::CoderJobInfo, Adapters::Kubernetes::K8sJobInfo
Instance Attribute Summary collapse
- 
  
    
      #accounting_id  ⇒ String? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The account the job is charged against. 
- 
  
    
      #allocated_nodes  ⇒ Array<NodeInfo> 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Set of machines that is utilized for job execution. 
- 
  
    
      #cpu_time  ⇒ Integer? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The accumulated CPU time in seconds. 
- 
  
    
      #dispatch_time  ⇒ Time? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The time the job first entered a “Started” state. 
- 
  
    
      #gpus  ⇒ Integer? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Number of gpus allocated for job. 
- 
  
    
      #id  ⇒ String 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The identifier of the job. 
- 
  
    
      #job_name  ⇒ String? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Name of the job. 
- 
  
    
      #job_owner  ⇒ String? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Owner of job. 
- 
  
    
      #native  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Native resource manager output for job info. 
- 
  
    
      #procs  ⇒ Integer? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Number of procs allocated for job. 
- 
  
    
      #queue_name  ⇒ String? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Name of the queue in which the job was queued or started. 
- 
  
    
      #status  ⇒ Status 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The status of the job. 
- 
  
    
      #submission_time  ⇒ Time? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The time at which the job was submitted. 
- 
  
    
      #submit_host  ⇒ String? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Name of the submission host for this job. 
- 
  
    
      #tasks  ⇒ Array<Task> 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    List of job array child task statuses. 
- 
  
    
      #wallclock_limit  ⇒ Integer? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The total wall clock time limit in seconds. 
- 
  
    
      #wallclock_time  ⇒ Integer? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The accumulated wall clock time in seconds. 
Instance Method Summary collapse
- 
  
    
      #==(other)  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    The comparison operator. 
- 
  
    
      #build_child_info(task)  ⇒ Info 
    
    
  
  
  
  
  
  
  
  
  
    Create a new Info for a child task. 
- 
  
    
      #eql?(other)  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Whether objects are identical to each other. 
- #gpu? ⇒ Boolean
- 
  
    
      #hash  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    Generate a hash value for this object. 
- 
  
    
      #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, gpus: 0, tasks: [], **_)  ⇒ Info 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Info. 
- 
  
    
      #to_h  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    Convert object to hash. 
Constructor Details
#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, gpus: 0, tasks: [], **_) ⇒ Info
Returns a new instance of Info.
| 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | # File 'lib/ood_core/job/info.rb', line 94 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, gpus: 0, 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 @gpus = gpus && gpus.to_i end | 
Instance Attribute Details
#accounting_id ⇒ String? (readonly)
The account the job is charged against
| 33 34 35 | # File 'lib/ood_core/job/info.rb', line 33 def accounting_id @accounting_id end | 
#allocated_nodes ⇒ Array<NodeInfo> (readonly)
Set of machines that is utilized for job execution
| 17 18 19 | # File 'lib/ood_core/job/info.rb', line 17 def allocated_nodes @allocated_nodes end | 
#cpu_time ⇒ Integer? (readonly)
The accumulated CPU time in seconds
| 53 54 55 | # File 'lib/ood_core/job/info.rb', line 53 def cpu_time @cpu_time end | 
#dispatch_time ⇒ Time? (readonly)
The time the job first entered a “Started” state
| 61 62 63 | # File 'lib/ood_core/job/info.rb', line 61 def dispatch_time @dispatch_time end | 
#gpus ⇒ Integer? (readonly)
Number of gpus allocated for job
| 70 71 72 | # File 'lib/ood_core/job/info.rb', line 70 def gpus @gpus end | 
#id ⇒ String (readonly)
The identifier of the job
| 9 10 11 | # File 'lib/ood_core/job/info.rb', line 9 def id @id end | 
#job_name ⇒ String? (readonly)
Name of the job
| 25 26 27 | # File 'lib/ood_core/job/info.rb', line 25 def job_name @job_name end | 
#job_owner ⇒ String? (readonly)
Owner of job
| 29 30 31 | # File 'lib/ood_core/job/info.rb', line 29 def job_owner @job_owner end | 
#native ⇒ Object (readonly)
Should not be used by generic apps
Native resource manager output for job info
| 66 67 68 | # File 'lib/ood_core/job/info.rb', line 66 def native @native end | 
#procs ⇒ Integer? (readonly)
Number of procs allocated for job
| 37 38 39 | # File 'lib/ood_core/job/info.rb', line 37 def procs @procs end | 
#queue_name ⇒ String? (readonly)
Name of the queue in which the job was queued or started
| 41 42 43 | # File 'lib/ood_core/job/info.rb', line 41 def queue_name @queue_name end | 
#status ⇒ Status (readonly)
The status of the job
| 13 14 15 | # File 'lib/ood_core/job/info.rb', line 13 def status @status end | 
#submission_time ⇒ Time? (readonly)
The time at which the job was submitted
| 57 58 59 | # File 'lib/ood_core/job/info.rb', line 57 def submission_time @submission_time end | 
#submit_host ⇒ String? (readonly)
Name of the submission host for this job
| 21 22 23 | # File 'lib/ood_core/job/info.rb', line 21 def submit_host @submit_host end | 
#tasks ⇒ Array<Task> (readonly)
only relevant for job arrays
List of job array child task statuses
| 75 76 77 | # File 'lib/ood_core/job/info.rb', line 75 def tasks @tasks end | 
#wallclock_limit ⇒ Integer? (readonly)
The total wall clock time limit in seconds
| 49 50 51 | # File 'lib/ood_core/job/info.rb', line 49 def wallclock_limit @wallclock_limit end | 
#wallclock_time ⇒ Integer? (readonly)
The accumulated wall clock time in seconds
| 45 46 47 | # File 'lib/ood_core/job/info.rb', line 45 def wallclock_time @wallclock_time end | 
Instance Method Details
#==(other) ⇒ Boolean
The comparison operator
| 168 169 170 | # File 'lib/ood_core/job/info.rb', line 168 def ==(other) to_h == other.to_h end | 
#build_child_info(task) ⇒ Info
Create a new Info for a child task
| 124 125 126 127 128 129 130 131 132 133 134 135 | # File 'lib/ood_core/job/info.rb', line 124 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 | 
#eql?(other) ⇒ Boolean
Whether objects are identical to each other
| 175 176 177 | # File 'lib/ood_core/job/info.rb', line 175 def eql?(other) self.class == other.class && self == other end | 
#gpu? ⇒ Boolean
| 161 162 163 | # File 'lib/ood_core/job/info.rb', line 161 def gpu? gpus.positive? end | 
#hash ⇒ Integer
Generate a hash value for this object
| 181 182 183 | # File 'lib/ood_core/job/info.rb', line 181 def hash [self.class, to_h].hash end | 
#to_h ⇒ Hash
Convert object to hash
| 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | # File 'lib/ood_core/job/info.rb', line 139 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, gpus: gpus, tasks: tasks } end |