[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there some syntax for executing {} for 1..Inf?
From: |
Ole Tange |
Subject: |
Re: Is there some syntax for executing {} for 1..Inf? |
Date: |
Sat, 23 Dec 2017 01:08:28 +0100 |
On Mon, Dec 18, 2017 at 10:48 PM, Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
:
> This works as expected, quits soon after the 2nd job fails:
>
> $ yes | parallel-20171122/src/parallel --jobs=2 --halt-on-error
> soon,fail=1 'echo {#}; if test {#} -ge 2; then exit 1; fi'
> 1
> 2
> parallel: This job failed:
> echo 2; if test 2 -ge 2; then exit 1; fi
> parallel: Starting no more jobs. Waiting for 1 jobs to finish.
> 3
> parallel: This job failed:
> echo 3; if test 3 -ge 2; then exit 1; fi
>
> But If I change that to:
>
> --jobs=1 --halt-on-error soon,fail=1
>
> It'll go on forever, however this'll "work":
>
> --jobs=1 --halt-on-error now,fail=1
Yup. That is a bug. "now" and "soon" should always start the same
amount of jobs. The only difference should be how the jobs finish.
> Which, not knowing the internals well, should be something like:
>
> if($Global::halt_when eq "soon"
> and $Global::max_jobs_running == 1 or scalar(keys
> %Global::running) > 0) {
>
> Or at least that makes this work for me.
You need a couple of () around the 'or' part, but other than that it
looks sound.
It should make it into next release.
/Ole