Class: OodCore::Job::Script
- Inherits:
-
Object
- Object
- OodCore::Job::Script
- Defined in:
- lib/ood_core/job/script.rb
Overview
An object that describes a batch job before it is submitted. This includes the resources this batch job will require of the resource manager.
Instance Attribute Summary collapse
-
#accounting_id ⇒ String?
readonly
The attribute used for job accounting purposes.
-
#args ⇒ Array<String>?
readonly
Arguments supplied to script to be executed.
-
#content ⇒ String
readonly
Content of the script to be executed on the remote host.
-
#copy_environment ⇒ Boolean
(also: #copy_environment?)
readonly
Flag whether the job should contain a copy of its calling environment.
-
#email ⇒ Array<String>?
readonly
List of email addresses that should be used when resource manager sends status notifications.
-
#email_on_started ⇒ Boolean?
readonly
Whether given email addresses should be notified when job starts.
-
#email_on_terminated ⇒ Boolean?
readonly
Whether given email addresses should be notified when job ends.
-
#error_path ⇒ Pathname?
readonly
Path to file specifying the error stream of the job.
-
#gpus_per_node ⇒ Integer?
readonly
The GPUs per node for the job.
-
#input_path ⇒ Pathname?
readonly
Path to file specifying the input stream of the job.
-
#job_array_request ⇒ String?
readonly
The job array request, commonly in the format '$START-$STOP'.
-
#job_environment ⇒ Hash{String=>String}?
readonly
Environment variables to be set on remote host when running job.
-
#job_name ⇒ String?
readonly
The name of the job.
-
#native ⇒ Object?
readonly
Object detailing any native specifications that are implementation specific.
-
#output_path ⇒ Pathname?
readonly
Path to file specifying the output stream of the job.
-
#priority ⇒ Integer?
readonly
The scheduling priority for the job.
-
#qos ⇒ String?
readonly
The qos selected for the job.
-
#queue_name ⇒ String?
(also: #queue)
readonly
Name of the queue the job should be submitted to.
-
#rerunnable ⇒ Boolean?
readonly
Whether job can safely be restarted by the resource manager, for example on node failure or some other re-scheduling event.
-
#reservation_id ⇒ String?
readonly
Identifier of existing reservation to be associated with the job.
-
#shell_path ⇒ Pathname?
readonly
Path to file specifying the login shell of the job.
-
#start_time ⇒ Time?
readonly
The earliest time when the job may be eligible to run.
-
#submit_as_hold ⇒ Boolean?
readonly
Whether job is held after submitted.
-
#wall_time ⇒ Integer?
readonly
The maximum amount of real time during which the job can be running in seconds.
-
#workdir ⇒ Pathname?
readonly
Directory where the job is executed from.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
The comparison operator.
-
#eql?(other) ⇒ Boolean
Whether objects are identical to each other.
-
#hash ⇒ Integer
Generate a hash value for this object.
-
#initialize(content:, args: nil, submit_as_hold: nil, rerunnable: nil, job_environment: nil, workdir: nil, email: nil, email_on_started: nil, email_on_terminated: nil, job_name: nil, shell_path: nil, input_path: nil, output_path: nil, error_path: nil, reservation_id: nil, queue_name: nil, priority: nil, start_time: nil, wall_time: nil, accounting_id: nil, job_array_request: nil, qos: nil, gpus_per_node: nil, native: nil, copy_environment: nil, **_) ⇒ Script
constructor
A new instance of Script.
-
#to_h ⇒ Hash
Convert object to hash.
Constructor Details
#initialize(content:, args: nil, submit_as_hold: nil, rerunnable: nil, job_environment: nil, workdir: nil, email: nil, email_on_started: nil, email_on_terminated: nil, job_name: nil, shell_path: nil, input_path: nil, output_path: nil, error_path: nil, reservation_id: nil, queue_name: nil, priority: nil, start_time: nil, wall_time: nil, accounting_id: nil, job_array_request: nil, qos: nil, gpus_per_node: nil, native: nil, copy_environment: nil, **_) ⇒ Script
Returns a new instance of Script.
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/ood_core/job/script.rb', line 147 def initialize(content:, args: nil, submit_as_hold: nil, rerunnable: nil, job_environment: nil, workdir: nil, email: nil, email_on_started: nil, email_on_terminated: nil, job_name: nil, shell_path: nil, input_path: nil, output_path: nil, error_path: nil, reservation_id: nil, queue_name: nil, priority: nil, start_time: nil, wall_time: nil, accounting_id: nil, job_array_request: nil, qos: nil, gpus_per_node: nil, native: nil, copy_environment: nil, **_) @content = content.to_s @submit_as_hold = submit_as_hold @rerunnable = rerunnable @email_on_started = email_on_started @email_on_terminated = email_on_terminated @args = args && args.map(&:to_s) @job_environment = job_environment && job_environment.each_with_object({}) { |(k, v), h| h[k.to_s] = v.to_s } @workdir = workdir && Pathname.new(workdir.to_s) @email = email && Array.wrap(email).map(&:to_s) @job_name = job_name && job_name.to_s @shell_path = shell_path && Pathname.new(shell_path.to_s) @input_path = input_path && Pathname.new(input_path.to_s) @output_path = output_path && Pathname.new(output_path.to_s) @error_path = error_path && Pathname.new(error_path.to_s) @reservation_id = reservation_id && reservation_id.to_s @queue_name = queue_name && queue_name.to_s @priority = priority && priority.to_i @start_time = start_time && Time.at(start_time.to_i) @wall_time = wall_time && wall_time.to_i @accounting_id = accounting_id && accounting_id.to_s @job_array_request = job_array_request && job_array_request.to_s @qos = qos && qos.to_s @gpus_per_node = gpus_per_node && gpus_per_node.to_i @native = native @copy_environment = (copy_environment.nil?) ? nil : !! copy_environment end |
Instance Attribute Details
#accounting_id ⇒ String? (readonly)
The attribute used for job accounting purposes
97 98 99 |
# File 'lib/ood_core/job/script.rb', line 97 def accounting_id @accounting_id end |
#args ⇒ Array<String>? (readonly)
Arguments supplied to script to be executed
18 19 20 |
# File 'lib/ood_core/job/script.rb', line 18 def args @args end |
#content ⇒ String (readonly)
Content of the script to be executed on the remote host
14 15 16 |
# File 'lib/ood_core/job/script.rb', line 14 def content @content end |
#copy_environment ⇒ Boolean (readonly) Also known as: copy_environment?
Flag whether the job should contain a copy of its calling environment
118 119 120 |
# File 'lib/ood_core/job/script.rb', line 118 def copy_environment @copy_environment end |
#email ⇒ Array<String>? (readonly)
List of email addresses that should be used when resource manager sends status notifications
43 44 45 |
# File 'lib/ood_core/job/script.rb', line 43 def email @email end |
#email_on_started ⇒ Boolean? (readonly)
Whether given email addresses should be notified when job starts
47 48 49 |
# File 'lib/ood_core/job/script.rb', line 47 def email_on_started @email_on_started end |
#email_on_terminated ⇒ Boolean? (readonly)
Whether given email addresses should be notified when job ends
51 52 53 |
# File 'lib/ood_core/job/script.rb', line 51 def email_on_terminated @email_on_terminated end |
#error_path ⇒ Pathname? (readonly)
Path to file specifying the error stream of the job
71 72 73 |
# File 'lib/ood_core/job/script.rb', line 71 def error_path @error_path end |
#gpus_per_node ⇒ Integer? (readonly)
The GPUs per node for the job
109 110 111 |
# File 'lib/ood_core/job/script.rb', line 109 def gpus_per_node @gpus_per_node end |
#input_path ⇒ Pathname? (readonly)
Path to file specifying the input stream of the job
63 64 65 |
# File 'lib/ood_core/job/script.rb', line 63 def input_path @input_path end |
#job_array_request ⇒ String? (readonly)
The job array request, commonly in the format '$START-$STOP'
101 102 103 |
# File 'lib/ood_core/job/script.rb', line 101 def job_array_request @job_array_request end |
#job_environment ⇒ Hash{String=>String}? (readonly)
These will override the remote host environment settings
Environment variables to be set on remote host when running job
34 35 36 |
# File 'lib/ood_core/job/script.rb', line 34 def job_environment @job_environment end |
#job_name ⇒ String? (readonly)
The name of the job
55 56 57 |
# File 'lib/ood_core/job/script.rb', line 55 def job_name @job_name end |
#native ⇒ Object? (readonly)
Should not be used at all costs.
Object detailing any native specifications that are implementation specific
114 115 116 |
# File 'lib/ood_core/job/script.rb', line 114 def native @native end |
#output_path ⇒ Pathname? (readonly)
Path to file specifying the output stream of the job
67 68 69 |
# File 'lib/ood_core/job/script.rb', line 67 def output_path @output_path end |
#priority ⇒ Integer? (readonly)
The scheduling priority for the job
84 85 86 |
# File 'lib/ood_core/job/script.rb', line 84 def priority @priority end |
#qos ⇒ String? (readonly)
The qos selected for the job
105 106 107 |
# File 'lib/ood_core/job/script.rb', line 105 def qos @qos end |
#queue_name ⇒ String? (readonly) Also known as: queue
Name of the queue the job should be submitted to
79 80 81 |
# File 'lib/ood_core/job/script.rb', line 79 def queue_name @queue_name end |
#rerunnable ⇒ Boolean? (readonly)
This SHOULD NOT be used to let the application denote the checkpointability of a job
Whether job can safely be restarted by the resource manager, for example on node failure or some other re-scheduling event
29 30 31 |
# File 'lib/ood_core/job/script.rb', line 29 def rerunnable @rerunnable end |
#reservation_id ⇒ String? (readonly)
Identifier of existing reservation to be associated with the job
75 76 77 |
# File 'lib/ood_core/job/script.rb', line 75 def reservation_id @reservation_id end |
#shell_path ⇒ Pathname? (readonly)
Path to file specifying the login shell of the job
59 60 61 |
# File 'lib/ood_core/job/script.rb', line 59 def shell_path @shell_path end |
#start_time ⇒ Time? (readonly)
The earliest time when the job may be eligible to run
88 89 90 |
# File 'lib/ood_core/job/script.rb', line 88 def start_time @start_time end |
#submit_as_hold ⇒ Boolean? (readonly)
Whether job is held after submitted
22 23 24 |
# File 'lib/ood_core/job/script.rb', line 22 def submit_as_hold @submit_as_hold end |
#wall_time ⇒ Integer? (readonly)
The maximum amount of real time during which the job can be running in seconds
93 94 95 |
# File 'lib/ood_core/job/script.rb', line 93 def wall_time @wall_time end |
#workdir ⇒ Pathname? (readonly)
Directory where the job is executed from
38 39 40 |
# File 'lib/ood_core/job/script.rb', line 38 def workdir @workdir end |
Instance Method Details
#==(other) ⇒ Boolean
The comparison operator
219 220 221 |
# File 'lib/ood_core/job/script.rb', line 219 def ==(other) to_h == other.to_h end |
#eql?(other) ⇒ Boolean
Whether objects are identical to each other
226 227 228 |
# File 'lib/ood_core/job/script.rb', line 226 def eql?(other) self.class == other.class && self == other end |
#hash ⇒ Integer
Generate a hash value for this object
232 233 234 |
# File 'lib/ood_core/job/script.rb', line 232 def hash [self.class, to_h].hash end |
#to_h ⇒ Hash
Convert object to hash
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/ood_core/job/script.rb', line 186 def to_h { content: content, args: args, submit_as_hold: submit_as_hold, rerunnable: rerunnable, job_environment: job_environment, workdir: workdir, email: email, email_on_started: email_on_started, email_on_terminated: email_on_terminated, job_name: job_name, shell_path: shell_path, input_path: input_path, output_path: output_path, error_path: error_path, reservation_id: reservation_id, queue_name: queue_name, priority: priority, start_time: start_time, wall_time: wall_time, accounting_id: accounting_id, job_array_request: job_array_request, qos: qos, gpus_per_node: gpus_per_node, native: native, copy_environment: copy_environment } end |