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
35 36 37 38 39 40 |
# File 'lib/blender/job.rb', line 35 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.
28 29 30 |
# File 'lib/blender/job.rb', line 28 def driver @driver end |
#hosts ⇒ Object (readonly)
Returns the value of attribute hosts.
28 29 30 |
# File 'lib/blender/job.rb', line 28 def hosts @hosts end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
28 29 30 |
# File 'lib/blender/job.rb', line 28 def id @id end |
#tasks ⇒ Object (readonly)
Returns the value of attribute tasks.
28 29 30 |
# File 'lib/blender/job.rb', line 28 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.
53 54 55 |
# File 'lib/blender/job.rb', line 53 def name @name ||= compute_name end |
#run ⇒ Object
42 43 44 |
# File 'lib/blender/job.rb', line 42 def run driver.execute(tasks, hosts) unless Configuration[:noop] end |
#to_s ⇒ Object
46 47 48 |
# File 'lib/blender/job.rb', line 46 def to_s "Job #{id} [#{name}]" end |