mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-22 20:57:53 +00:00
src/parallel: sshlogin now passes unittest.
Number of jobs to run on remote hosts is calculated wrongly.
This commit is contained in:
parent
c027f36ccf
commit
d26f62a363
21
src/parallel
21
src/parallel
|
@ -351,9 +351,9 @@ operating system and the B<-s> option. Pipe the input from /dev/null
|
|||
to do anything.
|
||||
|
||||
|
||||
=item B<-S> I<[ncpu/]sshlogin[,[ncpu/]sshlogin[,...]]> (not implemented)
|
||||
=item B<-S> I<[ncpu/]sshlogin[,[ncpu/]sshlogin[,...]]> (beta testing)
|
||||
|
||||
=item B<--sshlogin> I<[ncpu/]sshlogin[,[ncpu/]sshlogin[,...]]> (not implemented)
|
||||
=item B<--sshlogin> I<[ncpu/]sshlogin[,[ncpu/]sshlogin[,...]]> (beta testing)
|
||||
|
||||
Distribute jobs to remote servers. The jobs will be run on a list of
|
||||
remote servers. GNU B<parallel> will determine the number of CPU cores on
|
||||
|
@ -376,7 +376,7 @@ For examples: see B<--sshloginfile>.
|
|||
The remote host must have GNU B<parallel> installed.
|
||||
|
||||
|
||||
=item B<--sshloginfile> I<filename> (not implemented)
|
||||
=item B<--sshloginfile> I<filename> (beta testing)
|
||||
|
||||
File with sshlogins. The file consists of sshlogins on separate
|
||||
lines. Empty lines and lines starting with '#' are ignored. Example:
|
||||
|
@ -1403,7 +1403,8 @@ sub shell_quote {
|
|||
$arg =~ s/([\002-\011\013-\032])/\\$1/g;
|
||||
$arg =~ s/([\n])/'\n'/g; # filenames with '\n' is quoted using \'
|
||||
}
|
||||
return (@strings);
|
||||
#return wantarray ? @strings : "@strings";
|
||||
return @strings;
|
||||
}
|
||||
|
||||
# Replace foo{}bar or foo{.}bar
|
||||
|
@ -1708,6 +1709,16 @@ sub init_run_jobs {
|
|||
$SIG{TERM} = \&StartNoNewJobs;
|
||||
}
|
||||
|
||||
sub next_command_line_with_sshlogin {
|
||||
my $sshlogin = shift;
|
||||
my $next_command_line = next_command_line();
|
||||
if($next_command_line and $sshlogin ne ":") {
|
||||
return "ssh $sshlogin ".join("",shell_quote($next_command_line));
|
||||
} else {
|
||||
return $next_command_line;
|
||||
}
|
||||
}
|
||||
|
||||
sub next_command_line {
|
||||
my $cmd_line;
|
||||
if(@Global::unget_next_command_line) {
|
||||
|
@ -1791,7 +1802,7 @@ sub start_another_job {
|
|||
# Do we have enough file handles to start another job?
|
||||
my $sshlogin = shift;
|
||||
if(enough_file_handles()) {
|
||||
my $command = next_command_line();
|
||||
my $command = next_command_line_with_sshlogin($sshlogin);
|
||||
if(defined $command) {
|
||||
debug("Command to run on '$sshlogin': $command\n");
|
||||
my %jobinfo = start_job($command,$sshlogin);
|
||||
|
|
|
@ -66,6 +66,9 @@ a1.gifb1c1 a 2.gifb 2c 2 a 3.gifb 3c 3 a 4.gifb 4c 4 a 5.gifb 5c 5 a 6.gifb 6c 6
|
|||
10
|
||||
7
|
||||
9
|
||||
9
|
||||
9
|
||||
9
|
||||
'a'
|
||||
'a'
|
||||
begin
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
1
|
||||
2
|
||||
3
|
||||
sleep 1; echo 1
|
||||
1
|
||||
sleep 1; echo 2
|
||||
2
|
||||
ssh nlv.pi.dk sleep\ 1\;\ echo\ 3
|
||||
3
|
||||
ssh nlv.pi.dk sleep\ 1\;\ echo\ \\\>/tmp/fire
|
||||
>/tmp/fire
|
||||
sleep 1; echo 5
|
||||
5
|
||||
sleep 1; echo 6
|
||||
6
|
||||
ssh nlv.pi.dk sleep\ 1\;\ echo\ 7
|
||||
7
|
||||
ssh nlv.pi.dk sleep\ 1\;\ echo\ 8
|
||||
8
|
||||
sleep 1; echo 9
|
||||
9
|
||||
sleep 1; echo 10
|
||||
10
|
||||
sleep 1; hostname; echo 1
|
||||
alpha
|
||||
1
|
||||
sleep 1; hostname; echo 2
|
||||
alpha
|
||||
2
|
||||
ssh nlv.pi.dk sleep\ 1\;\ hostname\;\ echo\ 3
|
||||
nlv.pi.dk
|
||||
3
|
||||
ssh nlv.pi.dk sleep\ 1\;\ hostname\;\ echo\ \\\>/tmp/fire
|
||||
nlv.pi.dk
|
||||
>/tmp/fire
|
||||
sleep 1; hostname; echo 5
|
||||
alpha
|
||||
5
|
||||
sleep 1; hostname; echo 6
|
||||
alpha
|
||||
6
|
||||
ssh nlv.pi.dk sleep\ 1\;\ hostname\;\ echo\ 7
|
||||
nlv.pi.dk
|
||||
7
|
||||
ssh nlv.pi.dk sleep\ 1\;\ hostname\;\ echo\ 8
|
||||
nlv.pi.dk
|
||||
8
|
||||
sleep 1; hostname; echo 9
|
||||
alpha
|
||||
9
|
||||
sleep 1; hostname; echo 10
|
||||
alpha
|
||||
10
|
|
@ -34,6 +34,9 @@ seq 1 60000 | perl -pe 's/$/.gif\n/' | $PAR -kX echo a{}b{.}c{.} | wc -l
|
|||
seq 1 60000 | perl -pe 's/$/.gif\n/' | $PAR -kX echo a{}b{.}c | wc -l
|
||||
seq 1 60000 | perl -pe 's/$/.gif\n/' | $PAR -kX echo a{}b | wc -l
|
||||
seq 1 60000 | $PAR -I :: -X echo a::b::c:: | wc -l
|
||||
seq 1 60000 | $PAR -I '<>' -X echo 'a<>b<>c<>' | wc -l
|
||||
seq 1 60000 | $PAR -I '<' -X echo 'a<b<c<' | wc -l
|
||||
seq 1 60000 | $PAR -I '>' -X echo 'a>b>c>' | wc -l
|
||||
echo a | $PAR -qX echo "'"{.}"' "
|
||||
echo a | $PAR -qX echo "'{.}'"
|
||||
(echo "sleep 3; echo begin"; seq 1 30 | $PAR -kq echo "sleep 1; echo {.}"; echo "echo end") \
|
||||
|
|
|
@ -4,4 +4,8 @@ PAR=parallel
|
|||
|
||||
# Test sshlogin
|
||||
echo localhost >/tmp/localhost
|
||||
seq 1 3 | $PAR --sshlogin 8/al -S 7/"-l eiipe fod",: --sshloginfile /tmp/localhost echo
|
||||
seq 1 3 | $PAR -k --sshlogin 8/nlv.pi.dk -S 7/"-l tange nlv.pi.dk",: --sshloginfile /tmp/localhost echo
|
||||
|
||||
(seq 1 3;echo '>/tmp/fire';seq 5 10) | parallel -k -v -j+0 -S nlv.pi.dk,: "sleep 1; echo {}"
|
||||
# Check number of CPUs being respected
|
||||
(seq 1 3;echo '>/tmp/fire';seq 5 10) | parallel -k -v -j+0 -S 1/:,9/nlv.pi.dk "sleep 1; hostname; echo {}"
|
||||
|
|
|
@ -66,6 +66,9 @@ a1.gifb1c1 a 2.gifb 2c 2 a 3.gifb 3c 3 a 4.gifb 4c 4 a 5.gifb 5c 5 a 6.gifb 6c 6
|
|||
10
|
||||
7
|
||||
9
|
||||
9
|
||||
9
|
||||
9
|
||||
'a'
|
||||
'a'
|
||||
begin
|
||||
|
|
Loading…
Reference in a new issue