Ugly but... Chunk up the job and then you call wait with a
sufficiently big number that each chunk's pipes have time to terminate
before the next chunk.

More complicated (but prettier) would be a later -> wait combo (if
possible in your situation):

(dm evalAll> @
   (let Result
         (for N (getSockNums> This)
            (later (chain (cons "void"))
               (eval> This N (rest)))))
      (wait 5000 (not (memq "void" Result)))

The above example queries an arbitrary amount of external databases in
parallel, it waits for 5 seconds or until all of them have returned

On Tue, May 29, 2012 at 5:30 AM, José Romero <> wrote:
> On Mon, 28 May 2012 23:51:21 +0200
> Jorge Acereda <> wrote:
>> Hi,
>> I need to invoke external commands for each entry in my database and
>> I want to run those in parallel, but restricting the number of
>> simultaneous jobs to a certain number to avoid bringing the machine
>> to its knees (sort of 'make -jN').
>> How would you approach such problem?
> First a bit more of information is needed, what do you need to
> parallelize? The processing steps within each entry, or the processing
> of the entries themselves? Are there any dependencies that should be
> taken into account?
>> Thanks,
>>   Jorge
> Cheers,
> José
> --

Reply via email to