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.
-
#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.
-
#input_path ⇒ Pathname?
readonly
Path to file specifying the input stream of the job.
-
#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 ⇒ Fixnum?
readonly
The scheduling priority for the job.
-
#queue_name ⇒ String?
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.
-
#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 ⇒ Fixnum?
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 ⇒ Fixnum
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, 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, native: 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, 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, native: nil, **_) ⇒ Script
Returns a new instance of Script.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/ood_core/job/script.rb', line 119 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, 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, native: 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 @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 @native = native end |
Instance Attribute Details
#accounting_id ⇒ String? (readonly)
The attribute used for job accounting purposes
92 93 94 |
# File 'lib/ood_core/job/script.rb', line 92 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 |
#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
67 68 69 |
# File 'lib/ood_core/job/script.rb', line 67 def error_path @error_path end |
#input_path ⇒ Pathname? (readonly)
Path to file specifying the input stream of the job
59 60 61 |
# File 'lib/ood_core/job/script.rb', line 59 def input_path @input_path 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
97 98 99 |
# File 'lib/ood_core/job/script.rb', line 97 def native @native end |
#output_path ⇒ Pathname? (readonly)
Path to file specifying the output stream of the job
63 64 65 |
# File 'lib/ood_core/job/script.rb', line 63 def output_path @output_path end |
#priority ⇒ Fixnum? (readonly)
The scheduling priority for the job
79 80 81 |
# File 'lib/ood_core/job/script.rb', line 79 def priority @priority end |
#queue_name ⇒ String? (readonly)
Name of the queue the job should be submitted to
75 76 77 |
# File 'lib/ood_core/job/script.rb', line 75 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
71 72 73 |
# File 'lib/ood_core/job/script.rb', line 71 def reservation_id @reservation_id end |
#start_time ⇒ Time? (readonly)
The earliest time when the job may be eligible to run
83 84 85 |
# File 'lib/ood_core/job/script.rb', line 83 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 ⇒ Fixnum? (readonly)
The maximum amount of real time during which the job can be running in seconds
88 89 90 |
# File 'lib/ood_core/job/script.rb', line 88 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
180 181 182 |
# File 'lib/ood_core/job/script.rb', line 180 def ==(other) to_h == other.to_h end |
#eql?(other) ⇒ Boolean
Whether objects are identical to each other
187 188 189 |
# File 'lib/ood_core/job/script.rb', line 187 def eql?(other) self.class == other.class && self == other end |
#hash ⇒ Fixnum
Generate a hash value for this object
193 194 195 |
# File 'lib/ood_core/job/script.rb', line 193 def hash [self.class, to_h].hash end |
#to_h ⇒ Hash
Convert object to hash
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/ood_core/job/script.rb', line 152 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, 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, native: native } end |