parallel: -j1 --halt soon,fail=1 bug.

This commit is contained in:
Ole Tange 2017-12-21 18:40:03 +01:00
parent 400611158b
commit 414667b8b4
3 changed files with 37 additions and 1 deletions

View file

@ -9112,7 +9112,10 @@ sub set_exitsignal {
$Global::halt_exitstatus = 0;
}
if($Global::halt_when eq "soon"
and scalar(keys %Global::running) > 0) {
and
(scalar(keys %Global::running) > 0
or
$Global::max_jobs_running == 1)) {
::status
("$Global::progname: Starting no more jobs. ".
"Waiting for ". (keys %Global::running).

View file

@ -792,6 +792,18 @@ par_parset() {
echo "${myarray[4]} ${myarray[5]} ${myarray[5]}"
}
par_halt_one_job() {
echo '# Halt soon if there is a single job'
echo should run 0 1 = job 1 2
parallel -j1 --halt now,fail=1 'echo {#};exit {}' ::: 0 1 0
echo should run 1 = job 1
parallel -j1 --halt now,fail=1 'echo {#};exit {}' ::: 1 0 1
echo should run 0 1 = job 1 2
parallel -j1 --halt soon,fail=1 'echo {#};exit {}' ::: 0 1 0
echo should run 1 = job 1
parallel -j1 --halt soon,fail=1 'echo {#};exit {}' ::: 1 0 1
}
export -f $(compgen -A function | grep par_)
compgen -A function | grep par_ | sort |
parallel -j6 --tag -k --joblog +/tmp/jl-`basename $0` '{} 2>&1'

View file

@ -1359,6 +1359,27 @@ par_file_ending_in_newline ### Hans found a bug giving unitialized variable
par_file_ending_in_newline gzip /tmp/parallel_f1
par_file_ending_in_newline gzip /tmp/parallel_f2'
par_file_ending_in_newline '
par_halt_one_job # Halt soon if there is a single job
par_halt_one_job should run 0 1 = job 1 2
par_halt_one_job 1
par_halt_one_job 2
par_halt_one_job parallel: This job failed:
par_halt_one_job echo 2;exit 1
par_halt_one_job should run 1 = job 1
par_halt_one_job 1
par_halt_one_job parallel: This job failed:
par_halt_one_job echo 1;exit 1
par_halt_one_job should run 0 1 = job 1 2
par_halt_one_job 1
par_halt_one_job 2
par_halt_one_job parallel: This job failed:
par_halt_one_job echo 2;exit 1
par_halt_one_job parallel: Starting no more jobs. Waiting for 0 jobs to finish.
par_halt_one_job should run 1 = job 1
par_halt_one_job 1
par_halt_one_job parallel: This job failed:
par_halt_one_job echo 1;exit 1
par_halt_one_job parallel: Starting no more jobs. Waiting for 0 jobs to finish.
par_header_parens bug #49538: --header and {= =}
par_header_parens OK
par_header_parens OK