Sha256: 7db3581a40c22a7069861efc2dadbc4a13082907a8c4cf3ca416c9818887d958

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

module Rake ; end

require 'rake/comp_tree/driver'

module Rake
  module TaskManager
    def invoke_parallel(root_task_name) # :nodoc:
      CompTree::Driver.new { |driver|
        #
        # Build the computation tree from task prereqs.
        #
        parallel_tasks.each_pair { |task_name, cache|
          task = self[task_name]
          task_args, prereqs = cache
          children_names = prereqs.map { |child|
            child.name.to_sym
          }
          driver.define(task_name.to_sym, *children_names) {
            task.execute(task_args)
            true
          }
        }

        root_node = driver.nodes[root_task_name.to_sym]

        #
        # If there were nothing to do, there would be no root node.
        #
        if root_node
          #
          # Mark computation nodes without a function as computed.
          #
          root_node.each_downward { |node|
            unless node.function
              node.result = true
            end
          }

          #
          # Launch the computation.
          #
          driver.compute(root_node.name, num_threads)
        end
      }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
drake-0.8.4.1.0.16 lib/rake/parallel.rb
drake-0.8.4.1.0.17 lib/rake/parallel.rb
drake-0.8.4.1.0.18 lib/rake/parallel.rb