parallel: added '-' as valid input file for -S. Fixed bug for empty lines '| parallel'.

This commit is contained in:
Ole Tange 2011-06-03 14:53:14 +02:00
parent 64f0579195
commit ac928cf936
8 changed files with 47 additions and 41 deletions

View file

@ -1,30 +1,8 @@
parallel echo {} ::: 1 2 3
src/parallel echo {} ::: 1 2 3
parallel echo a{}b ::: 1 2 3
src/parallel echo a{}b ::: 1 2 3
parallel echo a{}b ::: 1/Q.e 2/W.t 3/E.f
src/parallel echo a{}b ::: 1/Q.e 2/W.t 3/E.f
parallel echo a{.}b ::: 1/Q.e 2/W.t 3/E.f
src/parallel echo a{.}b ::: 1/Q.e 2/W.t 3/E.f
parallel echo a{.}b {//} ::: 1/Q.e 2/W.t 3/E.f
src/parallel echo a{.}b {//} ::: 1/Q.e 2/W.t 3/E.f
parallel echo a{.}b {//}-{/.} ::: 1/Q.e 2/W.t 3/E.f
src/parallel echo a{.}b {//}-{/.} ::: 1/Q.e 2/W.t 3/E.f
parallel --xapply echo a{3.}b {//}-{/.} ::: 1/Q.e 2/W.t 3/E.f
src/parallel --xapply echo a{3.}b {//}-{/.} ::: 1/Q.e 2/W.t 3/E.f
parallel --xapply echo a{3.}b {//}-{/.} ::: 1/Q.e ::: 2/W.t ::: 3/E.f
src/parallel --xapply echo a{3.}b {//}-{/.} ::: 1/Q.e ::: 2/W.t ::: 3/E.f
BUG:
(echo echo a ; echo ; echo echo b) | parallel -k
Fixed bug in {n//}
-S - should read --sshloginfile from stdin
-X for multiple input sources:
parallel -X echo mkdir -p dir-{1} dir-{1}/subdir-{2} :::: <(seq 1 5) <(seq 5 8)
parallel -X echo mkdir -p dir-{1//} dir-{1.}/subdir-{2} ::: a/foo.d b/bar.d :::: <(seq 5 8)
Dont start:
* load

View file

@ -163,6 +163,7 @@ cc:Peter Simons <simons@cryp.to>, Sandro Cazzaniga <kharec@mandriva.org>,
Christian Faulhammer <fauli@gentoo.org>, Ryoichiro Suzuki <ryoichiro.suzuki@gmail.com>,
Jesse Alama <jesse.alama@gmail.com>
Libre.fm? Viva? VTEC? Yemen?
Subject: GNU Parallel 20110622 ('XXX') released
GNU Parallel 20116022 ('XXX') has been released. It is
@ -180,6 +181,9 @@ New in this release:
(standard input), so is possible to do:
parallel --nonall -S computer1,computer2 uptime
* Context replace now works with multiple input sources:
parallel -X echo {1}-{2} ::: 1 2 3 ::: a b c
* --noswap do not start a job on a server that is swapping.
* Article: Parallel processing without Hadoop!
@ -188,8 +192,11 @@ New in this release:
* Article in Linux Magazine (Spanish). Thanks to Ben Martin.
http://www.linux-magazine.es/issue/67/
* Blog post in Japanese. Thanks to Naoya Nakazawa.
http://www.sssg.org/blogs/naoya/archives/2003
* Blog post in English. Thanks to Dagon.
hekate.homeip.net/2011/05/29/
http://hekate.homeip.net/2011/05/29/
* Bug fixes and man page updates.

View file

@ -1349,21 +1349,29 @@ sub __REMOTE_SSH__ {}
sub read_sshloginfile {
# Returns: N/A
my $file = shift;
my $close = 1;
if($file eq "..") {
$file = $ENV{'HOME'}."/.parallel/sshloginfile";
}
if($file eq "-") {
*IN = *STDIN;
$close = 0;
} else {
if(not open(IN, $file)) {
print $Global::original_stderr "Cannot open $file\n";
exit(255);
}
}
while(<IN>) {
chomp;
/^\s*#/ and next;
/^\s*$/ and next;
push @Global::sshlogin, $_;
}
if($close) {
close IN;
}
}
sub parse_sshlogin {
# Returns: N/A
@ -1372,7 +1380,7 @@ sub parse_sshlogin {
for my $sshlogin (@Global::sshlogin) {
# Split up -S sshlogin,sshlogin
for my $s (split /,/, $sshlogin) {
if ($s eq "..") {
if ($s eq ".." or $s eq "-") {
read_sshloginfile($s);
} else {
push (@login, $s);
@ -3794,12 +3802,12 @@ sub get {
$self->{'return_files'},
);
$cmd_line->populate();
$self->set_seq($self->seq()+1);
::debug("cmd_line->number_of_args ".$cmd_line->number_of_args()."\n");
if(not $::opt_pipe and $cmd_line->number_of_args() == 0) {
if(not $::opt_pipe and ($cmd_line->number_of_args() == 0 or $cmd_line->replaced() eq "")) {
# We did not get more args - maybe at EOF string?
return undef;
} else {
$self->set_seq($self->seq()+1);
return ($cmd_line);
}
}
@ -4112,8 +4120,8 @@ sub nest_get {
next;
} else {
# read one
my $arg = read_arg_from_fh($self->{'fhs'}[$fhno])
|| next; # If we just read an EOF string: Treat this as EOF
my $arg = read_arg_from_fh($self->{'fhs'}[$fhno]);
defined($arg) || next; # If we just read an EOF string: Treat this as EOF
my $len = $#{$self->{'arg_matrix'}[$fhno]} + 1;
$self->{'arg_matrix'}[$fhno][$len] = $arg;
# make all new combinations

View file

@ -938,9 +938,9 @@ Do not use the first line of input (used by GNU B<parallel> itself
when called with B<--shebang>).
=item B<-S> I<[ncpu/]sshlogin[,[ncpu/]sshlogin[,...]]>
=item B<-S> I<[ncpu/]sshlogin[,[ncpu/]sshlogin[,...]]> (alpha testing)
=item B<--sshlogin> I<[ncpu/]sshlogin[,[ncpu/]sshlogin[,...]]>
=item B<--sshlogin> I<[ncpu/]sshlogin[,[ncpu/]sshlogin[,...]]> (alpha testing)
Distribute jobs to remote computers. The jobs will be run on a list of
remote computers. GNU B<parallel> will determine the number of CPU
@ -960,8 +960,8 @@ on the local computer.
The sshlogin '..' is special, it read sshlogins from ~/.parallel/sshloginfile
The sshlogin '-' is special, too, it read sshlogins stdin (standard input).
The sshlogin '-' is special, too, it read sshlogins from stdin
(standard input).
To specify more sshlogins separate the sshlogins by comma or repeat
the options multiple times.
@ -976,7 +976,7 @@ B<--sshlogin> is often used with B<--transfer>, B<--return>,
B<--cleanup>, and B<--trc>.
=item B<--sshloginfile> I<filename>
=item B<--sshloginfile> I<filename> (alpha testing)
File with sshlogins. The file consists of sshlogins on separate
lines. Empty lines and lines starting with '#' are ignored. Example:
@ -1002,6 +1002,8 @@ When using a different ssh program the last argument must be the hostname.
The sshloginfile '..' is special, it read sshlogins from
~/.parallel/sshloginfile
The sshloginfile '-' is special, too, it read sshlogins from stdin
(standard input).
=item B<--noswap> (alpha testing)

View file

@ -13,3 +13,6 @@ echo '### Test --keeporder'
echo '### Test SIGTERM'
(sleep 5; killall parallel -TERM) & seq 1 100 | stdout parallel -k -j9 sleep 3';' echo | sort
echo '### Test bug: empty line for | sh with -k'
(echo echo a ; echo ; echo echo b) | parallel -k

View file

@ -3,14 +3,17 @@
SERVER1=parallel-server3
SERVER2=parallel-server2
cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | parallel -k
echo '### Test --onall'
parallel --onall -S parallel@$SERVER2,$SERVER1 '(echo {3} {2}) | awk \{print\ \$2}' ::: a b c ::: 1 2 3
echo '### Test | --onall'
seq 3 | parallel --onall -S parallel@$SERVER2,$SERVER1 '(echo {3} {2}) | awk \{print\ \$2}' ::: a b c :::: -
echo '### Test --onall -u'
parallel --onall -S parallel@$SERVER2,$SERVER1 -u '(echo {3} {2}) | awk \{print\ \$2}' ::: a b c ::: 1 2 3 | sort
echo '### Test --nonall'
parallel --nonall -S parallel@$SERVER2,$SERVER1 'hostname'
parallel --nonall -S parallel@$SERVER2,$SERVER1 -u 'hostname;sleep 2;hostname'
echo '### Test read sshloginfile from STDIN'
echo nlv.pi.dk | parallel -S - --nonall hostname
echo nlv.pi.dk | parallel --sshloginfile - --nonall hostname
EOF

View file

@ -70,3 +70,5 @@ parallel: sleep 3; echo 15
parallel: sleep 3; echo 16
parallel: sleep 3; echo 17
parallel: sleep 3; echo 18
### Test bug: empty line for | sh with -k
a

View file

@ -62,3 +62,6 @@ nlv.pi.dk
vh2.pi.dk
nlv.pi.dk
vh2.pi.dk
### Test read sshloginfile from STDIN
nlv.pi.dk
nlv.pi.dk