Tuesday, July 26, 2011

Rake Tasks with Parallel Prerequisites


Tasks with Parallel Prerequisites

Rake allows parallel execution of prerequisites using the following syntax:
multitask :copy_files => [:copy_src, :copy_doc, :copy_bin] do
puts "All Copies Complete"
end
In this example, copy_files is a normal rake task. Its actions are executed whereever all of its prerequisites are done. The big difference is that the prerequisites (copy_src,copy_bin and copy_doc) are executed in parallel. Each of the prerequisites are run in their own Ruby thread, possibly allowing faster overall runtime.


No comments:

Post a Comment