class Blender::SchedulingStrategy::PerHost

Public Instance Methods

compute_jobs(tasks) click to toggle source
# 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 = 0
  jobs = hosts_list.first.map do |host|
    job_id = job_id + 1
    Job.new(job_id, Blender::Driver::Compound.new, tasks, [host])
  end
  Log.debug("Total jobs : #{jobs.size}")
  jobs
end