Class: Blender::Job
- Inherits:
-
Object
- Object
- Blender::Job
- Defined in:
- lib/blender/job.rb
Overview
A job represent encapsulates an array of tasks to be performed against an array of hosts. Jobs are created by scheduling strategies, and passed to underlying drivers for execution Tasks within a single job must has exactly same driver.
Instance Attribute Summary collapse
-
#driver ⇒ Object
readonly
Returns the value of attribute driver.
-
#hosts ⇒ Object
readonly
Returns the value of attribute hosts.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#tasks ⇒ Object
readonly
Returns the value of attribute tasks.
Instance Method Summary collapse
-
#initialize(id, driver, tasks, hosts) ⇒ Job
constructor
creates a new job.
-
#name ⇒ String
computes, momoize and return the name of the job name is used to summarize the job.
- #run ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(id, driver, tasks, hosts) ⇒ Job
creates a new job
34 35 36 37 38 39 |
# File 'lib/blender/job.rb', line 34 def initialize(id, driver, tasks, hosts) @id = id @tasks = Array(tasks) @hosts = Array(hosts) @driver = driver end |
Instance Attribute Details
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
27 28 29 |
# File 'lib/blender/job.rb', line 27 def driver @driver end |
#hosts ⇒ Object (readonly)
Returns the value of attribute hosts.
27 28 29 |
# File 'lib/blender/job.rb', line 27 def hosts @hosts end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
27 28 29 |
# File 'lib/blender/job.rb', line 27 def id @id end |
#tasks ⇒ Object (readonly)
Returns the value of attribute tasks.
27 28 29 |
# File 'lib/blender/job.rb', line 27 def tasks @tasks end |
Instance Method Details
#name ⇒ String
computes, momoize and return the name of the job name is used to summarize the job.
52 53 54 |
# File 'lib/blender/job.rb', line 52 def name @name ||= compute_name end |
#run ⇒ Object
41 42 43 |
# File 'lib/blender/job.rb', line 41 def run driver.execute(tasks, hosts) end |
#to_s ⇒ Object
45 46 47 |
# File 'lib/blender/job.rb', line 45 def to_s "Job #{id} [#{name}]" end |