diff --git a/doc/FUTURE_IDEAS b/doc/FUTURE_IDEAS index ad5b5a42..152d630c 100644 --- a/doc/FUTURE_IDEAS +++ b/doc/FUTURE_IDEAS @@ -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 diff --git a/doc/release_new_version b/doc/release_new_version index a2ca7c1f..97941554 100644 --- a/doc/release_new_version +++ b/doc/release_new_version @@ -163,6 +163,7 @@ cc:Peter Simons , Sandro Cazzaniga , Christian Faulhammer , Ryoichiro Suzuki , Jesse Alama +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. diff --git a/src/parallel b/src/parallel index a0d4ab20..d8edf739 100755 --- a/src/parallel +++ b/src/parallel @@ -1349,12 +1349,18 @@ sub __REMOTE_SSH__ {} sub read_sshloginfile { # Returns: N/A my $file = shift; + my $close = 1; if($file eq "..") { $file = $ENV{'HOME'}."/.parallel/sshloginfile"; } - if(not open(IN, $file)) { - print $Global::original_stderr "Cannot open $file\n"; - exit(255); + if($file eq "-") { + *IN = *STDIN; + $close = 0; + } else { + if(not open(IN, $file)) { + print $Global::original_stderr "Cannot open $file\n"; + exit(255); + } } while() { chomp; @@ -1362,7 +1368,9 @@ sub read_sshloginfile { /^\s*$/ and next; push @Global::sshlogin, $_; } - close IN; + if($close) { + close IN; + } } sub parse_sshlogin { @@ -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 diff --git a/src/parallel.pod b/src/parallel.pod index 8df46f02..557d6761 100644 --- a/src/parallel.pod +++ b/src/parallel.pod @@ -938,9 +938,9 @@ Do not use the first line of input (used by GNU B 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 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 +=item B<--sshloginfile> I (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) diff --git a/testsuite/tests-to-run/test13.sh b/testsuite/tests-to-run/test13.sh index 8a19552a..9b81b062 100755 --- a/testsuite/tests-to-run/test13.sh +++ b/testsuite/tests-to-run/test13.sh @@ -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 diff --git a/testsuite/tests-to-run/test60.sh b/testsuite/tests-to-run/test60.sh index 31fdd1c9..a03e2dc0 100644 --- a/testsuite/tests-to-run/test60.sh +++ b/testsuite/tests-to-run/test60.sh @@ -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 diff --git a/testsuite/wanted-results/test13 b/testsuite/wanted-results/test13 index d42e2f42..12fe6305 100644 --- a/testsuite/wanted-results/test13 +++ b/testsuite/wanted-results/test13 @@ -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 diff --git a/testsuite/wanted-results/test60 b/testsuite/wanted-results/test60 index f919b468..75967f21 100644 --- a/testsuite/wanted-results/test60 +++ b/testsuite/wanted-results/test60 @@ -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