Sha256: 52fe31f9d8b9f793676b75bdac17319737585b8ba75f24be95005957345744ad

Contents?: true

Size: 775 Bytes

Versions: 4

Compression:

Stored size: 775 Bytes

Contents

class Step
  def self.prepare_dependencies(jobs, tasks, cpus)
    deps = []

    jobs = [jobs] unless Array === jobs
    tasks = [tasks] unless Array === tasks
    tasks = tasks.collect{|t| t.to_s}

    jobs.each do |job|
      job.rec_dependencies.each do |dep|
        next if dep.done?
        deps << dep if tasks.include?(dep.task_name.to_s) or tasks.include?([dep.workflow.to_s, dep.task_name] * "#")
      end
    end

    cpus = jobs.length if cpus.to_s == "max"
    cpus = cpus.to_i if String === cpus
    TSV.traverse deps.collect{|dep| dep.path}, :type => :array, :cpus => cpus, :bar => "Prepare dependencies #{Misc.fingerprint tasks} for #{Misc.fingerprint job}" do |path|
      dep = deps.select{|dep| dep.path == path}.first
      dep.produce
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rbbt-util-5.26.3 lib/rbbt/workflow/prepare.rb
rbbt-util-5.26.2 lib/rbbt/workflow/prepare.rb
rbbt-util-5.26.1 lib/rbbt/workflow/prepare.rb
rbbt-util-5.26.0 lib/rbbt/workflow/prepare.rb