Class: Blender::SchedulingStrategy::Default

Inherits:
Base
  • Object
show all
Defined in:
lib/blender/scheduling_strategies/default.rb

Instance Method Summary collapse

Instance Method Details

#compute_jobs(tasks) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/blender/scheduling_strategies/default.rb', line 23

def compute_jobs(tasks)
  Log.debug("Computing jobs from #{tasks.size} tasks")
  pairs = tasks.map{|t| [t].product(t.hosts)}.flatten(1)
  job_id = 0
  jobs = pairs.map do |task, host|
    Log.debug("Creating job (#{host}|#{task.name})")
    job_id = job_id + 1
    Job.new(job_id, task.driver, [task], [host])
  end
  Log.debug("Total jobs : #{jobs.size}")
  jobs
end