Class: Blender::Job

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(id, driver, tasks, hosts) ⇒ Job

creates a new job

Parameters:



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

#driverObject (readonly)

Returns the value of attribute driver.



27
28
29
# File 'lib/blender/job.rb', line 27

def driver
  @driver
end

#hostsObject (readonly)

Returns the value of attribute hosts.



27
28
29
# File 'lib/blender/job.rb', line 27

def hosts
  @hosts
end

#idObject (readonly)

Returns the value of attribute id.



27
28
29
# File 'lib/blender/job.rb', line 27

def id
  @id
end

#tasksObject (readonly)

Returns the value of attribute tasks.



27
28
29
# File 'lib/blender/job.rb', line 27

def tasks
  @tasks
end

Instance Method Details

#nameString

computes, momoize and return the name of the job name is used to summarize the job.

Returns:

  • (String)


52
53
54
# File 'lib/blender/job.rb', line 52

def name
  @name ||= compute_name
end

#runObject



41
42
43
# File 'lib/blender/job.rb', line 41

def run
  driver.execute(tasks, hosts)
end

#to_sObject



45
46
47
# File 'lib/blender/job.rb', line 45

def to_s
  "Job #{id} [#{name}]"
end