parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

input buffering


From: Ryan Berckmans
Subject: input buffering
Date: Wed, 15 Nov 2017 08:05:13 -0500

When using GNU parallel 20160522 with bash 3.2.57(1)-release, my use case is of the form

slow-computation | parallel --pipe sh -c "quick-computation1 | quick-computation2"

In this case, slow-computation outputs one job per line of stdout. Each line of input is unbuffered and immediately available to parallel.

parallel seems to wait for input EOF before starting the first job. Is it possible to make parallel eagerly start jobs as they become available?

Reproduction:

sh -c 'for i in $(seq 5); do echo "line${i}"; sleep 1; done' | parallel echo // prints no output for 5 seconds, then all output at once
sh -c 'for i in $(seq 5); do echo "line${i}"; sleep 1; done' | xargs -n1 echo // prints one line every 1 second, but I'd rather use parallel :-)

Thanks,
Ryan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]