parallel
[Top][All Lists]
Advanced

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

Re: GNU Parallel Bug Reports Parallel as for (no argument)


From: Ole Tange
Subject: Re: GNU Parallel Bug Reports Parallel as for (no argument)
Date: Sun, 30 Oct 2016 20:39:09 +0100

On Sun, Oct 30, 2016 at 4:51 PM, Hadrien Lacour
<hadrien.lacour@openmailbox.org> wrote:
> On Sun, Oct 30, 2016 at 02:31:21PM +0100, Ole Tange wrote:
>> On Sat, Oct 29, 2016 at 12:43 PM, Hadrien Lacour
:
>> parallel --eta 'sleep 1; echo {2}' :::: <(seq 5) <(seq 5)
>>
>> /Ole
> This does produce the same output when adding -j1, but this actually does not
> solve my real problem which is that I have a script calling parallel, and
> wanted to iterate over this script (using parallel -j1)
>
>         parallel -j1 archive-convert.sh {} {.}.cbt ::: *.cbz
>
> archive-convert:
>         #!/bin/sh
>         workdir="$(mktemp -d)"
>         in=$(readlink -f "$1")
>         out=$(readlink -f "$2")
>
>         extract.sh "$in" "$workdir"
>         cd "$workdir"
>         optimise_images.sh
>         archive.sh . "$out"
>
>         rm -rf "$workdir"
>
> You can safely ignore extract.sh and archive.sh, but optimise_images.sh is:
>
>         printf 'Optimising jpgs...\n'
>         find -type f \( -name '*.jpg' -o -name '*.jpeg' \) -print0 | parallel 
> \
>                 --no-run-if-empty --null --eta /opt/mozjpeg/bin/jpegtran \
>                 -progressive -optimize -copy none -outfile {} {}
>
>         printf 'Optimising pngs...\n'
>         find -type f -name '*.png' -print0 | parallel --no-run-if-empty \
>                 --null --eta pngcrush -s -ow {} {}.temp
>
> And the parallel indirect nesting have with --eta (inner paralle) not 
> updating.

Nested parallels do not see eachother. But it seems that is OK for
you: The outer is running with -j1 anyway.

So what you are really asking is why you do not get any output from
archive-convert.sh until it is done.

The reason is that GNU Parallel defaults to buffering output. You can
disable that with -u:

    parallel -u -j1 archive-convert.sh {} {.}.cbt ::: *.cbz


/Ole



reply via email to

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