mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-26 07:57:58 +00:00
Re-fixed bug #45841: Replacement string for total no of jobs. --bar works, too.
This commit is contained in:
parent
03a35016a9
commit
b244ddf7ca
19
src/parallel
19
src/parallel
|
@ -5748,7 +5748,7 @@ sub new {
|
||||||
return bless {
|
return bless {
|
||||||
'unget' => \@unget,
|
'unget' => \@unget,
|
||||||
'commandlinequeue' => $commandlinequeue,
|
'commandlinequeue' => $commandlinequeue,
|
||||||
'this_job_no' => 1,
|
'this_job_no' => 0,
|
||||||
'total_jobs' => undef,
|
'total_jobs' => undef,
|
||||||
}, ref($class) || $class;
|
}, ref($class) || $class;
|
||||||
}
|
}
|
||||||
|
@ -5756,17 +5756,15 @@ sub new {
|
||||||
sub get {
|
sub get {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
if(@{$self->{'unget'}}) {
|
|
||||||
$self->{'this_job_no'}++;
|
$self->{'this_job_no'}++;
|
||||||
my $job = shift @{$self->{'unget'}};
|
if(@{$self->{'unget'}}) {
|
||||||
return ($job);
|
return shift @{$self->{'unget'}};
|
||||||
} else {
|
} else {
|
||||||
my $commandline = $self->{'commandlinequeue'}->get();
|
my $commandline = $self->{'commandlinequeue'}->get();
|
||||||
if(defined $commandline) {
|
if(defined $commandline) {
|
||||||
$self->{'this_job_no'}++;
|
return Job->new($commandline);
|
||||||
my $job = Job->new($commandline);
|
|
||||||
return $job;
|
|
||||||
} else {
|
} else {
|
||||||
|
$self->{'this_job_no'}--;
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5819,8 +5817,11 @@ sub total_jobs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$record_queue->unget(@arg_records);
|
$record_queue->unget(@arg_records);
|
||||||
$self->{'total_jobs'} = $#arg_records+1+$self->{'this_job_no'};
|
$self->{'total_jobs'} =
|
||||||
::debug("init","Total jobs: ".$self->{'total_jobs'}."\n");
|
::ceil((1+$#arg_records+$self->{'this_job_no'})
|
||||||
|
/ ::max($Global::max_number_of_args,1));
|
||||||
|
::debug("init","Total jobs: ".$self->{'total_jobs'}.
|
||||||
|
" (".(1+$#arg_records)."+".$self->{'this_job_no'}.")\n");
|
||||||
}
|
}
|
||||||
return $self->{'total_jobs'};
|
return $self->{'total_jobs'};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1198,13 +1198,16 @@ control on the command line (used by GNU B<parallel> internally when
|
||||||
called with B<--sshlogin>).
|
called with B<--sshlogin>).
|
||||||
|
|
||||||
|
|
||||||
=item B<--plus>
|
=item B<--plus> (alpha testing)
|
||||||
|
|
||||||
Activate additional replacement strings: {+/} {+.} {+..} {+...} {..}
|
Activate additional replacement strings: {+/} {+.} {+..} {+...} {..}
|
||||||
{...} {/..} {/...}. The idea being that '{+foo}' matches the opposite of
|
{...} {/..} {/...} {##}. The idea being that '{+foo}' matches the opposite of
|
||||||
'{foo}' and {} = {+/}/{/} = {.}.{+.} = {+/}/{/.}.{+.} = {..}.{+..} =
|
'{foo}' and {} = {+/}/{/} = {.}.{+.} = {+/}/{/.}.{+.} = {..}.{+..} =
|
||||||
{+/}/{/..}.{+..} = {...}.{+...} = {+/}/{/...}.{+...}
|
{+/}/{/..}.{+..} = {...}.{+...} = {+/}/{/...}.{+...}
|
||||||
|
|
||||||
|
B<{##}> is the number of jobs to be run. It is incompatible with
|
||||||
|
B<-X>/B<-m>/B<--xargs>.
|
||||||
|
|
||||||
|
|
||||||
=item B<--progress>
|
=item B<--progress>
|
||||||
|
|
||||||
|
|
|
@ -233,10 +233,10 @@ parallel --wd . 'pwd; echo $OLDPWD; echo' ::: OK
|
||||||
echo '**'
|
echo '**'
|
||||||
|
|
||||||
echo 'bug #46232: {%} with --bar/--eta/--shuf or --halt xx% broken'
|
echo 'bug #46232: {%} with --bar/--eta/--shuf or --halt xx% broken'
|
||||||
parallel --bar -kj2 echo {%} ::: a b ::: c d e 2>/dev/null
|
parallel --bar -kj2 --delay 0.1 echo {%} ::: a b ::: c d e 2>/dev/null
|
||||||
parallel --halt now,fail=10% -kj2 echo {%} ::: a b ::: c d e
|
parallel --halt now,fail=10% -kj2 --delay 0.1 echo {%} ::: a b ::: c d e
|
||||||
parallel --eta -kj2 echo {%} ::: a b ::: c d e 2>/dev/null
|
parallel --eta -kj2 --delay 0.1 echo {%} ::: a b ::: c d e 2>/dev/null
|
||||||
parallel --shuf -kj2 echo {%} ::: a b ::: c d e 2>/dev/null
|
parallel --shuf -kj2 --delay 0.1 echo {%} ::: a b ::: c d e 2>/dev/null
|
||||||
|
|
||||||
echo '**'
|
echo '**'
|
||||||
|
|
||||||
|
@ -251,6 +251,9 @@ echo '{##} bug #45841: Replacement string for total no of jobs'
|
||||||
|
|
||||||
parallel --plus echo {##} ::: {a..j};
|
parallel --plus echo {##} ::: {a..j};
|
||||||
parallel -k 'echo {= $::G++ > 3 and ($_=$Global::JobQueue->total_jobs());=}' ::: {1..10}
|
parallel -k 'echo {= $::G++ > 3 and ($_=$Global::JobQueue->total_jobs());=}' ::: {1..10}
|
||||||
|
parallel -N7 --plus echo {#} {##} ::: {1..14}
|
||||||
|
parallel -N7 --plus echo {#} {##} ::: {1..15}
|
||||||
|
parallel -X --plus echo {#} {##} ::: {1..15}
|
||||||
|
|
||||||
echo '**'
|
echo '**'
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,6 @@ Non-shellshock-hardened to shellshock-hardened
|
||||||
Function shellshock-hardened
|
Function shellshock-hardened
|
||||||
echo '### Test --load (must give 1=true)'
|
echo '### Test --load (must give 1=true)'
|
||||||
### Test --load (must give 1=true)
|
### Test --load (must give 1=true)
|
||||||
parallel -j0 -N0 --timeout 5 --nice 10 'bzip2 < /dev/zero >/dev/null' ::: 1 2 3 & parallel --argsep ,, --joblog - -N0 parallel --load 100% echo ::: 1 ,, 1 | parallel --colsep '\t' --header : echo '{=4 $_=$_>5=}'
|
parallel -j0 -N0 --timeout 5 --nice 10 'bzip2 < /dev/zero >/dev/null' ::: 1 2 3 4 5 6 & parallel --argsep ,, --joblog - -N0 parallel --load 100% echo ::: 1 ,, 1 | parallel --colsep '\t' --header : echo '{=4 $_=$_>5=}'
|
||||||
|
|
||||||
1
|
1
|
||||||
|
|
|
@ -479,28 +479,28 @@ echo '**'
|
||||||
**
|
**
|
||||||
echo 'bug #46232: {%} with --bar/--eta/--shuf or --halt xx% broken'
|
echo 'bug #46232: {%} with --bar/--eta/--shuf or --halt xx% broken'
|
||||||
bug #46232: {%} with --bar/--eta/--shuf or --halt xx% broken
|
bug #46232: {%} with --bar/--eta/--shuf or --halt xx% broken
|
||||||
parallel --bar -kj2 echo {%} ::: a b ::: c d e 2>/dev/null
|
parallel --bar -kj2 --delay 0.1 echo {%} ::: a b ::: c d e 2>/dev/null
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
parallel --halt now,fail=10% -kj2 echo {%} ::: a b ::: c d e
|
parallel --halt now,fail=10% -kj2 --delay 0.1 echo {%} ::: a b ::: c d e
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
parallel --eta -kj2 echo {%} ::: a b ::: c d e 2>/dev/null
|
parallel --eta -kj2 --delay 0.1 echo {%} ::: a b ::: c d e 2>/dev/null
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
parallel --shuf -kj2 echo {%} ::: a b ::: c d e 2>/dev/null
|
parallel --shuf -kj2 --delay 0.1 echo {%} ::: a b ::: c d e 2>/dev/null
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
1
|
1
|
||||||
|
@ -542,6 +542,22 @@ echo '{##} bug #45841: Replacement string for total no of jobs'
|
||||||
10
|
10
|
||||||
10
|
10
|
||||||
10
|
10
|
||||||
|
parallel -N7 --plus echo {#} {##} ::: {1..14}
|
||||||
|
1 2 2 2 2 2 2 2
|
||||||
|
2 2 2 2 2 2 2 2
|
||||||
|
parallel -N7 --plus echo {#} {##} ::: {1..15}
|
||||||
|
1 3 3 3 3 3 3 3
|
||||||
|
2 3 3 3 3 3 3 3
|
||||||
|
3 3
|
||||||
|
parallel -X --plus echo {#} {##} ::: {1..15}
|
||||||
|
1 15 15
|
||||||
|
2 15 15
|
||||||
|
3 15 15
|
||||||
|
4 15 15
|
||||||
|
5 15 15
|
||||||
|
6 15 15
|
||||||
|
7 15 15
|
||||||
|
8 15
|
||||||
echo '**'
|
echo '**'
|
||||||
**
|
**
|
||||||
### 1 .par file from --files expected
|
### 1 .par file from --files expected
|
||||||
|
|
Loading…
Reference in a new issue