Fixed bug #57886: Errors when using different version on remote.

This commit is contained in:
Ole Tange 2020-03-22 13:50:17 +01:00
parent ab074aa198
commit 36912dc230
4 changed files with 22 additions and 14 deletions

View file

@ -23,7 +23,7 @@
use strict;
use Getopt::Long;
$Global::progname="niceload";
$Global::version = 20200322;
$Global::version = 20200323;
Getopt::Long::Configure("bundling","require_order");
get_options_from_array(\@ARGV) || die_usage();
if($opt::version) {

View file

@ -2146,7 +2146,7 @@ sub check_invalid_option_combinations() {
sub init_globals() {
# Defaults:
$Global::version = 20200322;
$Global::version = 20200323;
$Global::progname = 'parallel';
$::name = "GNU Parallel";
$Global::infinity = 2**31;
@ -4356,33 +4356,39 @@ sub parallelized_host_filtering() {
sub sshwrapped {
# Wrap with ssh and --env
# Return $default_value if command fails
my $sshlogin = shift;
my $command = shift;
my $commandline = CommandLine->new(1,[$command],{},0,0,[],[],{},{},{});
my $default_value = shift;
# wrapper that returns $default_value if the command fails:
# bug #57886: Errors when using different version on remote
# perl -e '$a=`$command`; print $? ? "$default_value" : $a'
my $wcmd = q(perl -e '$a=`).$command.q(`;).
q(print $? ? ").::pQ($default_value).q(" : $a');
my $commandline = CommandLine->new(1,[$wcmd],{},0,0,[],[],{},{},{});
my $job = Job->new($commandline);
$job->set_sshlogin($sshlogin);
$job->wrapped();
return($job->{'wrapped'});
}
my(@sockets, @cores, @threads, @maxline, @echo);
while (my ($host, $sshlogin) = each %Global::host) {
if($host eq ":") { next }
# The 'true' is used to get the $host out later
push(@sockets, $host."\t"."true $host; ".
sshwrapped($sshlogin,"parallel --number-of-sockets")."\n\0");
sshwrapped($sshlogin,"parallel --number-of-sockets",0)."\n\0");
push(@cores, $host."\t"."true $host; ".
sshwrapped($sshlogin,"parallel --number-of-cores")."\n\0");
sshwrapped($sshlogin,"parallel --number-of-cores",0)."\n\0");
push(@threads, $host."\t"."true $host; ".
sshwrapped($sshlogin,"parallel --number-of-threads")."\n\0");
sshwrapped($sshlogin,"parallel --number-of-threads",0)."\n\0");
push(@maxline, $host."\t"."true $host; ".
sshwrapped($sshlogin,"parallel --max-line-length-allowed")."\n\0");
sshwrapped($sshlogin,"parallel --max-line-length-allowed",0)."\n\0");
# 'echo' is used to get the fastest possible ssh login time
my $sshcmd = "true $host; exec " .$sshlogin->sshcommand()." ".
$sshlogin->serverlogin();
push(@echo, $host."\t".$sshcmd." -- echo\n\0");
}
# --timeout 10: Setting up an SSH connection and running a simple
# command should never take > 10 sec.
# --delay 0.1: If multiple sshlogins use the same proxy the delay
@ -4398,6 +4404,8 @@ sub parallelized_host_filtering() {
my ($host_fh,$in,$err);
open3($in, $host_fh, $err, $cmd) || ::die_bug("parallel host check: $cmd");
::debug("init", map { $_,"\n" } @sockets, @cores, @threads, @maxline, @echo);
if(not fork()) {
# Give the commands to run to the $cmd
close $host_fh;

View file

@ -469,7 +469,7 @@ basename of input line.
Use the replacement string I<replace-str> instead of B<{/.}> for basename of input line without extension.
=item B<--bin> I<binexpr> (alpha testing)
=item B<--bin> I<binexpr> (beta testing)
Use I<binexpr> as binning key and bin input to the jobs.
@ -2302,7 +2302,7 @@ when called with B<--shebang>).
Use B<--sqlmaster> instead.
=item B<--sqlmaster> I<DBURL> (alpha testing)
=item B<--sqlmaster> I<DBURL> (beta testing)
Submit jobs via SQL server. I<DBURL> must point to a table, which will
contain the same information as B<--joblog>, the values from the input
@ -2340,12 +2340,12 @@ It can also be an alias from ~/.sql/aliases:
:myalias mysql:///mydb/paralleljobs
=item B<--sqlandworker> I<DBURL> (alpha testing)
=item B<--sqlandworker> I<DBURL> (beta testing)
Shorthand for: B<--sqlmaster> I<DBURL> B<--sqlworker> I<DBURL>.
=item B<--sqlworker> I<DBURL> (alpha testing)
=item B<--sqlworker> I<DBURL> (beta testing)
Execute jobs via SQL server. Read the input sources variables from the
table pointed to by I<DBURL>. The I<command> on the command line

View file

@ -574,7 +574,7 @@ $Global::Initfile && unlink $Global::Initfile;
exit ($err);
sub parse_options {
$Global::version = 20200322;
$Global::version = 20200323;
$Global::progname = 'sql';
# This must be done first as this may exec myself