Class: Blender::SchedulingStrategy::PerHost

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

Instance Method Summary collapse

Instance Method Details

#compute_jobs(tasks) ⇒ Object



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

def compute_jobs(tasks)
  Log.debug("Computing jobs from #{tasks.size} tasks")
  hosts_list = tasks.map(&:hosts).uniq
  if hosts_list.size != 1
    raise UnsupportedFeature, 'PerHost strategy does not support scheduling tasks with different memebers'
  end
  job_id = 1
  jobs = hosts_list.first.map do |host|
    Job.new(job_id, Blender::Driver::Compound.new, tasks, [host])
  end
  Log.debug("Total jobs : #{jobs.size}")
  jobs
end