[Rake-devel] Rake 0.9.3.beta.2 with -j option

Torsten at Robitzki.de Torsten at Robitzki.de
Sat Oct 27 19:03:50 UTC 2012


Hello to all,

Am 24.10.2012 um 01:05 schrieb Jim Weirich:

> So you check out a new project from GitHub and decide to run rake on it.  How do you decide if its safe to run with -j or not?  Try it and see?  Wait for subtle unreproducible race conditions to manifest?

one solution could be do have an API function that must have been called from the rakefile to allow concurrent execution of Tasks. If that function wasn't called, -j defaults to 1 (is ignored). This has the drawback that a rakefile has to explicitly enable parallel execution but on the other side, thread unsafe rakefile won't executed in parallel. Example:

rakefile:

enable_parallel

task :one do
  #compile file one
end

task :two do
  #compile file two
end

task :all => [:one, :two] do
  #link file one and two
end

running rake with -j 2 could execute task :one and :two in parallel. Without the call to enable_parallel(), -j would effectively ignored.

kind regards 
Torsten



More information about the Rake-devel mailing list