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:



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

#driverObject (readonly)

Returns the value of attribute driver.



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

def driver
  @driver
end

#hostsObject (readonly)

Returns the value of attribute hosts.



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

def hosts
  @hosts
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#tasksObject (readonly)

Returns the value of attribute tasks.



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

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)


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

def name
  @name ||= compute_name
end

#runObject



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

def run
  driver.execute(tasks, hosts) unless Configuration[:noop]
end

#to_sObject



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

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