On Mon, Apr 27, 2015 at 5:46 PM, Martin d'Anjou <[email protected]> wrote: : > halt_argument_value: "never" | (("onsuccess" | "onfail") "," quantity > "," consequence) > quantity: number | pct > number: [1-9][0-9]* > pct:[1-9][0-9] "%" > consequence: "killpending" | "killall" : > onsuccess,N,consequence > Halt after N jobs run sucessfully. > > The number N ranges from 1 to the total number of jobs, or a > percentage. If N is a percentage (N%), then at least 3 jobs have run > to completion before GNU Parallel considers making a decision. GNU > parallel will halt when the percentage of successful jobs will equal > or exceed N%. > > If the consequence is "killpending", GNU parallel will wait for > all running jobs to come to completion, but no more new jobs will be > dispatched (the pending jobs will be killed). > > If the consequence is "killall", GNU parallel will stop > dispatching jobs and will kill all the running jobs.
I think we are pretty much in agreement. I just prefer calling 'killall' for '--halt now' and 'killpending' for '--halt soon'. So: halt soon if failed jobs = 20%: --halt soon,fail,20% (if 20% have failed, start no new jobs and wait until the running jobs have finished). halt now if number of successes = 3: --halt now,success,3 (if 3 jobs succeeded, start no new jobs and kill off the running jobs now). halt never: --halt 0 == --halt never The reason I want N > 2 is to avoid confusion with existing (magic) numbers, and so that order does not matter: soon,fail,20 == 20,fail,soon But I can easily imagine that N=1 would be nice to have: Of the 10000 solutions find one that works and stop. Maybe by simply requiring giving all 3 parameters? And I will suggest that you can use mix , and = as separators, so you can write it as: --halt now,fail=1 == --halt now,fail,1 > Backward compatibility: > > --halt 0 is the same as --halt never > > --halt 1 is the same as --halt onfail,1,killpending --halt soon,fail=1 > --halt 2 has no equivalents (it does not make sense to orphan jobs) But --halt 2 should probably killall anyway. --halt now,fail=1 > --halt -1 is the same as --halt onsuccess,1,killpending --halt soon,success=1 > --halt -2 has no equivalents (it does not make sense to orphan jobs) But --halt -2 should probably killall anyway. --halt now,success=1 > --halt 1-99% is equivalent to --halt onfail,1-99%,killpending --halt soon,fail=1-99% I think we are close to a decent design, and I will see how hard that is to implement. /Ole
