mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 22:17:54 +00:00
parallel: added $PARALLEL_SSH.
This commit is contained in:
parent
31564e97fc
commit
2549b9ba1a
22
src/parallel
22
src/parallel
|
@ -5387,6 +5387,8 @@ sub sshcommand_of_sshlogin {
|
||||||
# login@host
|
# login@host
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($sshcmd, $serverlogin);
|
my ($sshcmd, $serverlogin);
|
||||||
|
# If $SSH is unset, use 'ssh'
|
||||||
|
$ENV{'PARALLEL_SSH'} ||= "ssh";
|
||||||
if($self->{'string'} =~ /(.+) (\S+)$/) {
|
if($self->{'string'} =~ /(.+) (\S+)$/) {
|
||||||
# Own ssh command
|
# Own ssh command
|
||||||
$sshcmd = $1; $serverlogin = $2;
|
$sshcmd = $1; $serverlogin = $2;
|
||||||
|
@ -5395,7 +5397,7 @@ sub sshcommand_of_sshlogin {
|
||||||
if($opt::controlmaster) {
|
if($opt::controlmaster) {
|
||||||
# Use control_path to make ssh faster
|
# Use control_path to make ssh faster
|
||||||
my $control_path = $self->control_path_dir()."/ssh-%r@%h:%p";
|
my $control_path = $self->control_path_dir()."/ssh-%r@%h:%p";
|
||||||
$sshcmd = "ssh -S ".$control_path;
|
$sshcmd = $ENV{'PARALLEL_SSH'}." -S ".$control_path;
|
||||||
$serverlogin = $self->{'string'};
|
$serverlogin = $self->{'string'};
|
||||||
if(not $self->{'control_path'}{$control_path}++) {
|
if(not $self->{'control_path'}{$control_path}++) {
|
||||||
# Master is not running for this control_path
|
# Master is not running for this control_path
|
||||||
|
@ -5407,18 +5409,24 @@ sub sshcommand_of_sshlogin {
|
||||||
$SIG{'TERM'} = undef;
|
$SIG{'TERM'} = undef;
|
||||||
# Ignore the 'foo' being printed
|
# Ignore the 'foo' being printed
|
||||||
open(STDOUT,">","/dev/null");
|
open(STDOUT,">","/dev/null");
|
||||||
# OpenSSH_3.6.1p2 gives 'tcgetattr: Invalid argument' with -tt
|
# With -tt OpenSSH_3.6.1p2 gives:
|
||||||
# STDERR >/dev/null to ignore "process_mux_new_session: tcgetattr: Invalid argument"
|
# 'tcgetattr: Invalid argument'
|
||||||
|
# STDERR >/dev/null to ignore
|
||||||
|
# "process_mux_new_session: tcgetattr: Invalid argument"
|
||||||
open(STDERR,">","/dev/null");
|
open(STDERR,">","/dev/null");
|
||||||
open(STDIN,"<","/dev/null");
|
open(STDIN,"<","/dev/null");
|
||||||
# Run a sleep that outputs data, so it will discover if the ssh connection closes.
|
# Run a sleep that outputs data, so it will discover
|
||||||
my $sleep = ::shell_quote_scalar('$|=1;while(1){sleep 1;print "foo\n"}');
|
# if the ssh connection closes.
|
||||||
my @master = ("ssh", "-tt", "-MTS", $control_path, $serverlogin, "perl", "-e", $sleep);
|
my $sleep = ::shell_quote_scalar
|
||||||
|
('$|=1;while(1){sleep 1;print "foo\n"}');
|
||||||
|
my @master = ($ENV{'PARALLEL_SSH'}, "-tt", "-MTS",
|
||||||
|
$control_path, $serverlogin, "perl", "-e",
|
||||||
|
$sleep);
|
||||||
exec(@master);
|
exec(@master);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$sshcmd = "ssh"; $serverlogin = $self->{'string'};
|
$sshcmd = $ENV{'PARALLEL_SSH'}; $serverlogin = $self->{'string'};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$self->{'sshcommand'} = $sshcmd;
|
$self->{'sshcommand'} = $sshcmd;
|
||||||
|
|
|
@ -697,9 +697,9 @@ See also: B<--line-buffer> B<--ungroup>
|
||||||
Print a summary of the options to GNU B<parallel> and exit.
|
Print a summary of the options to GNU B<parallel> and exit.
|
||||||
|
|
||||||
|
|
||||||
=item B<--halt-on-error> I<val>
|
=item B<--halt-on-error> I<val> (alpha testing)
|
||||||
|
|
||||||
=item B<--halt> I<val>
|
=item B<--halt> I<val> (alpha testing)
|
||||||
|
|
||||||
When should GNU B<parallel> terminate? In some situations it makes no
|
When should GNU B<parallel> terminate? In some situations it makes no
|
||||||
sense to run all jobs. GNU B<parallel> should simply give up as soon
|
sense to run all jobs. GNU B<parallel> should simply give up as soon
|
||||||
|
@ -1665,7 +1665,7 @@ Does not run the command but quotes it. Useful for making quoted
|
||||||
composed commands for GNU B<parallel>.
|
composed commands for GNU B<parallel>.
|
||||||
|
|
||||||
|
|
||||||
=item B<--shuf> (beta testing)
|
=item B<--shuf> (alpha testing)
|
||||||
|
|
||||||
Shuffle jobs. When having multiple input sources it is hard to
|
Shuffle jobs. When having multiple input sources it is hard to
|
||||||
randomize jobs. --shuf will generate all jobs, and shuffle them before
|
randomize jobs. --shuf will generate all jobs, and shuffle them before
|
||||||
|
@ -3439,6 +3439,13 @@ $SHELL. If undefined use:
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
|
||||||
|
=item $PARALLEL_SSH (alpha testing)
|
||||||
|
|
||||||
|
GNU B<parallel> defaults to using B<ssh> for remote access. This can
|
||||||
|
be overridden with $PARALLEL_SSH. It can also be set on a per server
|
||||||
|
basis (see B<--sshlogin>).
|
||||||
|
|
||||||
|
|
||||||
=item $PARALLEL_SEQ
|
=item $PARALLEL_SEQ
|
||||||
|
|
||||||
$PARALLEL_SEQ will be set to the sequence number of the job
|
$PARALLEL_SEQ will be set to the sequence number of the job
|
||||||
|
|
|
@ -61,6 +61,11 @@ echo '### bug #40001: --joblog and --nonall seem not to work together:'
|
||||||
echo '### bug #40132: FreeBSD: --workdir . gives warning if . == $HOME'
|
echo '### bug #40132: FreeBSD: --workdir . gives warning if . == $HOME'
|
||||||
cd && parallel --workdir . -S lo pwd ::: ""
|
cd && parallel --workdir . -S lo pwd ::: ""
|
||||||
|
|
||||||
|
echo '### use function as $PARALLEL_SSH'
|
||||||
|
foossh() { echo "FOOSSH" >&2; ssh "$@"; };
|
||||||
|
export -f foossh;
|
||||||
|
PARALLEL_SSH=foossh parallel -S 1/lo echo ::: 'Run through FOOSSH?'
|
||||||
|
|
||||||
echo '### test filename :'
|
echo '### test filename :'
|
||||||
echo content-of-: > :;
|
echo content-of-: > :;
|
||||||
echo : | parallel -j1 --trc {}.{.} -S parallel@lo '(echo remote-{}.{.};cat {}) > {}.{.}';
|
echo : | parallel -j1 --trc {}.{.} -S parallel@lo '(echo remote-{}.{.};cat {}) > {}.{.}';
|
||||||
|
|
|
@ -84,6 +84,11 @@ echo '### bug #40132: FreeBSD: --workdir . gives warning if . == $HOME'
|
||||||
### bug #40132: FreeBSD: --workdir . gives warning if . == $HOME
|
### bug #40132: FreeBSD: --workdir . gives warning if . == $HOME
|
||||||
cd && parallel --workdir . -S lo pwd ::: ""
|
cd && parallel --workdir . -S lo pwd ::: ""
|
||||||
/home/tange
|
/home/tange
|
||||||
|
echo '### use function as $PARALLEL_SSH'
|
||||||
|
### use function as $PARALLEL_SSH
|
||||||
|
foossh() { echo "FOOSSH" >&2; ssh "$@"; }; export -f foossh; PARALLEL_SSH=foossh parallel -S 1/lo echo ::: 'Run through FOOSSH?'
|
||||||
|
Run through FOOSSH?
|
||||||
|
FOOSSH
|
||||||
echo '### test filename :'
|
echo '### test filename :'
|
||||||
### test filename :
|
### test filename :
|
||||||
echo content-of-: > :; echo : | parallel -j1 --trc {}.{.} -S parallel@lo '(echo remote-{}.{.};cat {}) > {}.{.}'; cat :.:; rm : :.:
|
echo content-of-: > :; echo : | parallel -j1 --trc {}.{.} -S parallel@lo '(echo remote-{}.{.};cat {}) > {}.{.}'; cat :.:; rm : :.:
|
||||||
|
|
Loading…
Reference in a new issue