From: Trans Date: 2008-09-10T08:48:49+09:00 Subject: Re: Drake: Distributed Rake On Sep 9, 1:54 pm, Trans wrote: > On Sep 9, 2:58 am, quixoticsycoph...@gmail.com wrote: > > > > > In a given Rakefile, it is possible (even likely) that the dependency > > tree has not been properly defined.  Consider > > >    task :a => [:x, :y, :z] > > > With single-threaded Rake, _x_,_y_,_z_ will be invoked *in that order* > > before _a_ is invoked.  However with drake --threads=N (for N > 1), > > one should not expect any particular order of execution.  Since there > > is no dependency specified between _x_,_y_,_z_ above, Drake is free to > > run them in any order. > > > If you wish _x_,_y_,_z_ to be invoked sequentially, then write > > >    task :a => seq[:x, :y, :z] > > > This is shorthand for > > >    task :a => :z > >    task :z => :y > >    task :y => :x > > > Upon invoking _a_, the above rules say: "Can't do _a_ until _z_ is > > complete; can't do _z_ until _y_ is complete; can't do _y_ until _x_ > > is complete; therefore do _x_."  In this fashion the sequence > > _x_,_y_,_z_ is enforced. > > > The problem of insufficient dependencies plagues Makefiles as well. > > Package maintainers affectionately call it "not j-safe." > > Hmmm.... this is not backward compatible. Things could go very badly > if I tried -j3 on my "badly" written Rakefiles. > > May I make a suggestion? Have > >     task :a => [:x, :y, :z] > > translate into the task :a => :z => :y => :x thing. And then > >     task :a => [[:x, :y, :z]] > > Run in parrallel. > > That way all old script work fine, and as we get smart and make our > tasks j-safe we can add the extra "j-array". I thought someone else might notice it and elaborate but there is another potential benefit of this notation. Eg. task :a => [[:x, :y, :z], [:m, :n], :r] Where :x, :y, :z can be run in parallel, as can :m and :n, but the groups must run one before the other. T.