mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 14:07:55 +00:00
testsuite: --env test now much faster.
parallel: Small code cleanup.
This commit is contained in:
parent
02d6dcece5
commit
828843fa15
18
src/parallel
18
src/parallel
|
@ -199,6 +199,7 @@ if($opt::nonall or $opt::onall) {
|
||||||
((defined $opt::group) ? "-g" : ""),
|
((defined $opt::group) ? "-g" : ""),
|
||||||
((defined $opt::D) ? "-D" : ""),
|
((defined $opt::D) ? "-D" : ""),
|
||||||
((defined $opt::plain) ? "--plain" : ""),
|
((defined $opt::plain) ? "--plain" : ""),
|
||||||
|
((defined $opt::max_chars) ? "--max-chars ".$opt::max_chars : ""),
|
||||||
);
|
);
|
||||||
my $suboptions =
|
my $suboptions =
|
||||||
join(" ",
|
join(" ",
|
||||||
|
@ -211,6 +212,7 @@ if($opt::nonall or $opt::onall) {
|
||||||
((defined $opt::timeout) ? "--timeout ".$opt::timeout : ""),
|
((defined $opt::timeout) ? "--timeout ".$opt::timeout : ""),
|
||||||
((defined $opt::plain) ? "--plain" : ""),
|
((defined $opt::plain) ? "--plain" : ""),
|
||||||
((defined $opt::retries) ? "--retries ".$opt::retries : ""),
|
((defined $opt::retries) ? "--retries ".$opt::retries : ""),
|
||||||
|
((defined $opt::max_chars) ? "--max-chars ".$opt::max_chars : ""),
|
||||||
(@opt::env ? map { "--env ".::shell_quote_scalar($_) } @opt::env : ""),
|
(@opt::env ? map { "--env ".::shell_quote_scalar($_) } @opt::env : ""),
|
||||||
);
|
);
|
||||||
::debug("| $0 $options\n");
|
::debug("| $0 $options\n");
|
||||||
|
@ -578,7 +580,7 @@ sub options_hash {
|
||||||
# xargs-compatibility - implemented, man, testsuite
|
# xargs-compatibility - implemented, man, testsuite
|
||||||
"max-procs|P=s" => \$opt::P,
|
"max-procs|P=s" => \$opt::P,
|
||||||
"delimiter|d=s" => \$opt::d,
|
"delimiter|d=s" => \$opt::d,
|
||||||
"max-chars|s=i" => \$opt::s,
|
"max-chars|s=i" => \$opt::max_chars,
|
||||||
"arg-file|a=s" => \@opt::a,
|
"arg-file|a=s" => \@opt::a,
|
||||||
"no-run-if-empty|r" => \$opt::r,
|
"no-run-if-empty|r" => \$opt::r,
|
||||||
"replace|i:s" => \$opt::i,
|
"replace|i:s" => \$opt::i,
|
||||||
|
@ -4118,7 +4120,7 @@ sub print {
|
||||||
# Verbose level > 1: Print the rsync and stuff
|
# Verbose level > 1: Print the rsync and stuff
|
||||||
$cmd = $command;
|
$cmd = $command;
|
||||||
}
|
}
|
||||||
printf $Global::joblog
|
print $Global::joblog
|
||||||
join("\t", $self->seq(), $self->sshlogin()->string(),
|
join("\t", $self->seq(), $self->sshlogin()->string(),
|
||||||
$self->starttime(), $self->runtime(),
|
$self->starttime(), $self->runtime(),
|
||||||
$self->transfersize(), $self->returnsize(),
|
$self->transfersize(), $self->returnsize(),
|
||||||
|
@ -4917,15 +4919,15 @@ sub max_length {
|
||||||
# Returns:
|
# Returns:
|
||||||
# number of chars on the longest command line allowed
|
# number of chars on the longest command line allowed
|
||||||
if(not $Limits::Command::line_max_len) {
|
if(not $Limits::Command::line_max_len) {
|
||||||
if($opt::s) {
|
if($opt::max_chars) {
|
||||||
if(is_acceptable_command_line_length($opt::s)) {
|
if(is_acceptable_command_line_length($opt::max_chars)) {
|
||||||
$Limits::Command::line_max_len = $opt::s;
|
$Limits::Command::line_max_len = $opt::max_chars;
|
||||||
} else {
|
} else {
|
||||||
# -s is too long: Find the correct
|
# -s is too long: Find the correct
|
||||||
$Limits::Command::line_max_len = binary_find_max_length(0,$opt::s);
|
$Limits::Command::line_max_len = binary_find_max_length(0,$opt::max_chars);
|
||||||
}
|
}
|
||||||
if($opt::s <= $Limits::Command::line_max_len) {
|
if($opt::max_chars <= $Limits::Command::line_max_len) {
|
||||||
$Limits::Command::line_max_len = $opt::s;
|
$Limits::Command::line_max_len = $opt::max_chars;
|
||||||
} else {
|
} else {
|
||||||
::warning("Value for -s option ",
|
::warning("Value for -s option ",
|
||||||
"should be < $Limits::Command::line_max_len.\n");
|
"should be < $Limits::Command::line_max_len.\n");
|
||||||
|
|
|
@ -2412,7 +2412,7 @@ files over high speed connections.
|
||||||
The following will start one @strong{rsync} per big file in @emph{src-dir} to
|
The following will start one @strong{rsync} per big file in @emph{src-dir} to
|
||||||
@emph{dest-dir} on the server @emph{fooserver}:
|
@emph{dest-dir} on the server @emph{fooserver}:
|
||||||
|
|
||||||
@strong{find src-dir -type f -size +100000 | parallel -v ssh fooserver
|
@strong{cd src-dir; find . -type f -size +100000 | parallel -v ssh fooserver
|
||||||
mkdir -p /dest-dir/@{//@}\;rsync -Havessh @{@} fooserver:/dest-dir/@{@}}
|
mkdir -p /dest-dir/@{//@}\;rsync -Havessh @{@} fooserver:/dest-dir/@{@}}
|
||||||
|
|
||||||
The dirs created may end up with wrong permissions and smaller files
|
The dirs created may end up with wrong permissions and smaller files
|
||||||
|
@ -2420,6 +2420,11 @@ are not being transferred. To fix those run @strong{rsync} a final time:
|
||||||
|
|
||||||
@strong{rsync -Havessh src-dir/ fooserver:/dest-dir/}
|
@strong{rsync -Havessh src-dir/ fooserver:/dest-dir/}
|
||||||
|
|
||||||
|
If you are unable to push data, but need to pull them and the files
|
||||||
|
are called digits.png (e.g. 000000.png) you might be able to do:
|
||||||
|
|
||||||
|
<seq -w 0 99 | parallel rsync -Havessh fooserver:src-path/*@{@}.png destdir/>
|
||||||
|
|
||||||
@chapter EXAMPLE: Use multiple inputs in one command
|
@chapter EXAMPLE: Use multiple inputs in one command
|
||||||
@anchor{EXAMPLE: Use multiple inputs in one command}
|
@anchor{EXAMPLE: Use multiple inputs in one command}
|
||||||
|
|
||||||
|
@ -3694,10 +3699,10 @@ released version you should specify why you believe the problem is not
|
||||||
fixed in that version.
|
fixed in that version.
|
||||||
|
|
||||||
@item A complete example that others can run that shows the problem. This
|
@item A complete example that others can run that shows the problem. This
|
||||||
should preferably be small and simple. A combination of @strong{seq},
|
should preferably be small and simple. A combination of @strong{yes}, @strong{seq},
|
||||||
@strong{cat}, @strong{echo}, and @strong{sleep} can reproduce most errors. If your
|
@strong{cat}, @strong{echo}, and @strong{sleep} can reproduce most errors. If your
|
||||||
example requires large files, see if you can make them by something
|
example requires large files, see if you can make them by something
|
||||||
like @strong{seq 1000000} > @strong{file}.
|
like @strong{seq 1000000} > @strong{file} or @strong{yes | head -n 10000000} > @strong{file}.
|
||||||
|
|
||||||
@item The output of your example. If your problem is not easily reproduced
|
@item The output of your example. If your problem is not easily reproduced
|
||||||
by others, the output might help them figure out the problem.
|
by others, the output might help them figure out the problem.
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
echo '### Test --env all chars except \n,\92,\160 - single and double - no output is good'
|
|
||||||
# 92 and 160 are special for csh
|
|
||||||
perl -e 'for(1..9,9,11..91,91,93..159,159,161..255) { printf "%c%c %c%d\0",$_,$_,$_,$_ }' | stdout parallel --nice 10 -j4 -k -I // --arg-sep _ -0 V=// V2=V2=// parallel --retries 3 -k -j1 -S :,1/lo,1/tcsh@lo,1/csh@lo --env V,V2 echo \''"{}$V$V2"'\' ::: {#} {#} {#} {#} | uniq -c | grep -v ' 4 '|grep -v xauth |grep -v X11
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
echo '### Test --env all chars except \n,\92,\160 - single and double --onall - no output is good'
|
|
||||||
# 92 and 160 are special for csh
|
|
||||||
perl -e 'for(1..9,9,11..91,91,93..159,159,161..255) { printf "%c%c %c%d\0",$_,$_,$_,$_ }' | stdout parallel --nice 10 -j4 -k -I // --arg-sep _ -0 V=// V2=V2=// parallel --retries 5 -k -j1 -S :,1/lo,1/tcsh@lo,1/csh@lo --onall --env V,V2 echo \''"{}$V$V2"'\' ::: {#} | uniq -c | grep -v ' 4 '|grep -v xauth |grep -v X11
|
|
|
@ -1 +0,0 @@
|
||||||
### Test --env all chars except \n,\92,\160 - single and double --onall - no output is good
|
|
Loading…
Reference in a new issue