mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 14:07:55 +00:00
Fixed bug #47695: How to set $PATH on remote?
This commit is contained in:
parent
51f212e548
commit
ff27e601bf
|
@ -258,6 +258,10 @@ for Big Data Applications https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumb
|
||||||
|
|
||||||
* <<link No citation: Next-generation TCP for ns-3 simulator http://www.sciencedirect.com/science/article/pii/S1569190X15300939>>
|
* <<link No citation: Next-generation TCP for ns-3 simulator http://www.sciencedirect.com/science/article/pii/S1569190X15300939>>
|
||||||
|
|
||||||
|
* GNU Parallel is a fantastic utility https://www.dray.be/parallel/
|
||||||
|
|
||||||
|
* Tools of the trade http://onox.com.br/2015/05/tools-of-the-trade/#more-198
|
||||||
|
|
||||||
* Bug fixes and man page updates.
|
* Bug fixes and man page updates.
|
||||||
|
|
||||||
GNU Parallel - For people who live life in the parallel lane.
|
GNU Parallel - For people who live life in the parallel lane.
|
||||||
|
|
38
src/parallel
38
src/parallel
|
@ -2944,7 +2944,7 @@ sub setup_basefile {
|
||||||
::wait_and_exit(255);
|
::wait_and_exit(255);
|
||||||
}
|
}
|
||||||
if(not $workdir) {
|
if(not $workdir) {
|
||||||
my $dummycmdline = CommandLine->new(1,"true",0,0,0,0,0,{},{},{});
|
my $dummycmdline = CommandLine->new(1,["true"],{},0,0,[],[],{},{},{});
|
||||||
my $dummyjob = Job->new($dummycmdline);
|
my $dummyjob = Job->new($dummycmdline);
|
||||||
$workdir = $dummyjob->workdir();
|
$workdir = $dummyjob->workdir();
|
||||||
}
|
}
|
||||||
|
@ -3037,7 +3037,6 @@ sub parse_host_filtering {
|
||||||
# \%echo = echo received from {host}
|
# \%echo = echo received from {host}
|
||||||
# \@down_hosts = list of hosts with no answer
|
# \@down_hosts = list of hosts with no answer
|
||||||
my (%ncores, %ncpus, %time_to_login, %maxlen, %echo, @down_hosts);
|
my (%ncores, %ncpus, %time_to_login, %maxlen, %echo, @down_hosts);
|
||||||
|
|
||||||
for (@_) {
|
for (@_) {
|
||||||
::debug("init",$_);
|
::debug("init",$_);
|
||||||
chomp;
|
chomp;
|
||||||
|
@ -3052,7 +3051,8 @@ sub parse_host_filtering {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
# Get server from: eval true server\;
|
# Get server from: eval true server\;
|
||||||
$col[8] =~ /eval true..([^;]+).;/ or ::die_bug("col8 does not contain host: $col[8]");
|
$col[8] =~ /eval true..([^;]+).;/ or
|
||||||
|
::die_bug("col8 does not contain host: $col[8]");
|
||||||
my $host = $1;
|
my $host = $1;
|
||||||
$host =~ tr/\\//d;
|
$host =~ tr/\\//d;
|
||||||
$Global::host{$host} or next;
|
$Global::host{$host} or next;
|
||||||
|
@ -3122,20 +3122,32 @@ sub parallelized_host_filtering {
|
||||||
# * hostname \t number of cpus
|
# * hostname \t number of cpus
|
||||||
# * hostname \t max-line-length-allowed
|
# * hostname \t max-line-length-allowed
|
||||||
# * hostname \t empty
|
# * hostname \t empty
|
||||||
|
|
||||||
|
sub sshwrapped {
|
||||||
|
# Wrap with ssh and --env
|
||||||
|
my $sshlogin = shift;
|
||||||
|
my $command = shift;
|
||||||
|
my $commandline = CommandLine->new(1,[$command],{},0,0,[],[],{},{},{});
|
||||||
|
my $job = Job->new($commandline);
|
||||||
|
$job->set_sshlogin($sshlogin);
|
||||||
|
$job->wrapped();
|
||||||
|
return($job->{'wrapped'});
|
||||||
|
}
|
||||||
|
|
||||||
my(@cores, @cpus, @maxline, @echo);
|
my(@cores, @cpus, @maxline, @echo);
|
||||||
my $envvar = ::shell_quote_scalar($Global::envvar);
|
my $envvar = ::shell_quote_scalar($Global::envvar);
|
||||||
while (my ($host, $sshlogin) = each %Global::host) {
|
while (my ($host, $sshlogin) = each %Global::host) {
|
||||||
if($host eq ":") { next }
|
if($host eq ":") { next }
|
||||||
# The 'true' is used to get the $host out later
|
# The 'true' is used to get the $host out later
|
||||||
|
push(@cores, $host."\t"."true $host; ".
|
||||||
|
sshwrapped($sshlogin,"parallel --number-of-cores")."\n\0");
|
||||||
|
push(@cpus, $host."\t"."true $host; ".
|
||||||
|
sshwrapped($sshlogin,"parallel --number-of-cpus")."\n\0");
|
||||||
|
push(@maxline, $host."\t"."true $host; ".
|
||||||
|
sshwrapped($sshlogin,"parallel --max-line-length-allowed")."\n\0");
|
||||||
|
# 'echo' is used to get the fastest possible ssh login time
|
||||||
my $sshcmd = "true $host; exec " .$sshlogin->sshcommand()." ".
|
my $sshcmd = "true $host; exec " .$sshlogin->sshcommand()." ".
|
||||||
$sshlogin->serverlogin();
|
$sshlogin->serverlogin();
|
||||||
push(@cores, $host."\t".$sshcmd." -- ".$envvar.
|
|
||||||
" parallel --number-of-cores\n\0");
|
|
||||||
push(@cpus, $host."\t".$sshcmd." -- ".$envvar.
|
|
||||||
" parallel --number-of-cpus\n\0");
|
|
||||||
push(@maxline, $host."\t".$sshcmd." -- ".$envvar.
|
|
||||||
" parallel --max-line-length-allowed\n\0");
|
|
||||||
# 'echo' is used to get the best possible value for an ssh login time
|
|
||||||
push(@echo, $host."\t".$sshcmd." -- echo\n\0");
|
push(@echo, $host."\t".$sshcmd." -- echo\n\0");
|
||||||
}
|
}
|
||||||
my ($fh, $tmpfile) = ::tmpfile(SUFFIX => ".ssh");
|
my ($fh, $tmpfile) = ::tmpfile(SUFFIX => ".ssh");
|
||||||
|
@ -3147,11 +3159,11 @@ sub parallelized_host_filtering {
|
||||||
# will make it less likely to overload the ssh daemon.
|
# will make it less likely to overload the ssh daemon.
|
||||||
# --retries 3: If the ssh daemon it overloaded, try 3 times
|
# --retries 3: If the ssh daemon it overloaded, try 3 times
|
||||||
# -s 16000: Half of the max line on UnixWare
|
# -s 16000: Half of the max line on UnixWare
|
||||||
# TODO sh -c wrapper to work in csh
|
|
||||||
my $unlinkcmd = $Global::debug ? "true" : "rm $tmpfile";
|
my $unlinkcmd = $Global::debug ? "true" : "rm $tmpfile";
|
||||||
my $cmd = "($unlinkcmd; cat -) < $tmpfile | ".
|
my $cmd = "($unlinkcmd; cat -) < $tmpfile | ".
|
||||||
"$0 -j0 --timeout 10 -s 16000 --joblog - --plain --delay 0.1 --retries 3 ".
|
"$0 -j0 --timeout 10 --joblog - --plain --delay 0.1 --retries 3 ".
|
||||||
"--tag --tagstring {1} -0 --colsep '\t' -k eval {2} 2>/dev/null";
|
"--tag --tagstring '{1}' -0 --colsep '\t' -k eval '{2}' ";
|
||||||
|
$cmd = $Global::shell." -c ".::shell_quote_scalar($cmd);
|
||||||
::debug("init", $cmd, "\n");
|
::debug("init", $cmd, "\n");
|
||||||
my @out;
|
my @out;
|
||||||
my $prepend = "";
|
my $prepend = "";
|
||||||
|
|
|
@ -84,3 +84,35 @@ echo '### exported function to csh but with PARALLEL_SHELL=bash'
|
||||||
PARALLEL_SHELL=bash parallel --env doit -S csh@lo doit ::: OK
|
PARALLEL_SHELL=bash parallel --env doit -S csh@lo doit ::: OK
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
echo 'bug #47695: How to set $PATH on remote?'
|
||||||
|
rm -rf /tmp/parallel
|
||||||
|
cp /usr/local/bin/parallel /tmp
|
||||||
|
|
||||||
|
cat <<'_EOS' | stdout ssh nopathbash@lo -T
|
||||||
|
echo BASH Path before: $PATH with no parallel
|
||||||
|
parallel echo ::: 1
|
||||||
|
echo '^^^^^^^^ Not found is OK'
|
||||||
|
# Exporting a big variable should not fail
|
||||||
|
export A="`seq 1000`"
|
||||||
|
PATH=$PATH:/tmp
|
||||||
|
. /usr/local/bin/env_parallel.bash
|
||||||
|
# --filter to see if $PATH with parallel is transferred
|
||||||
|
env_parallel --filter --env A,PATH -Slo echo '$PATH' ::: OK
|
||||||
|
_EOS
|
||||||
|
echo
|
||||||
|
|
||||||
|
cat <<'_EOS' | stdout ssh nopathcsh@lo -T
|
||||||
|
echo CSH Path before: $PATH with no parallel
|
||||||
|
which parallel >& /dev/stdout
|
||||||
|
echo '^^^^^^^^ Not found is OK'
|
||||||
|
alias parallel=/tmp/parallel
|
||||||
|
# Exporting a big variable should not fail
|
||||||
|
setenv A "`seq 1000`"
|
||||||
|
setenv PATH ${PATH}:/tmp
|
||||||
|
cp /usr/local/bin/env_parallel.csh /tmp
|
||||||
|
# --filter to see if $PATH with parallel is transferred
|
||||||
|
env_parallel --filter --env A,PATH -Slo echo '$PATH' ::: OK
|
||||||
|
_EOS
|
||||||
|
|
||||||
|
|
|
@ -122,3 +122,31 @@ echo '### exported function to csh but with PARALLEL_SHELL=bash'
|
||||||
doit() { echo "$1"; }; export -f doit; stdout parallel --env doit -S csh@lo doit ::: not_OK; PARALLEL_SHELL=bash parallel --env doit -S csh@lo doit ::: OK
|
doit() { echo "$1"; }; export -f doit; stdout parallel --env doit -S csh@lo doit ::: not_OK; PARALLEL_SHELL=bash parallel --env doit -S csh@lo doit ::: OK
|
||||||
CSH/TCSH DO NOT SUPPORT newlines IN VARIABLES/FUNCTIONS. Unset doit
|
CSH/TCSH DO NOT SUPPORT newlines IN VARIABLES/FUNCTIONS. Unset doit
|
||||||
OK
|
OK
|
||||||
|
bug #47695: How to set $PATH on remote?
|
||||||
|
Welcome to Linux Mint 17 Qiana (GNU/Linux 3.16.0-31-lowlatency x86_64)
|
||||||
|
|
||||||
|
Welcome to Linux Mint
|
||||||
|
* Documentation: http://www.linuxmint.com
|
||||||
|
|
||||||
|
195 packages can be updated.
|
||||||
|
0 updates are security updates.
|
||||||
|
|
||||||
|
BASH Path before: /bin:/usr/bin with no parallel
|
||||||
|
-bash: line 2: parallel: command not found
|
||||||
|
^^^^^^^^ Not found is OK
|
||||||
|
/bin:/usr/bin:/tmp OK
|
||||||
|
|
||||||
|
Welcome to Linux Mint 17 Qiana (GNU/Linux 3.16.0-31-lowlatency x86_64)
|
||||||
|
|
||||||
|
Welcome to Linux Mint
|
||||||
|
* Documentation: http://www.linuxmint.com
|
||||||
|
|
||||||
|
195 packages can be updated.
|
||||||
|
0 updates are security updates.
|
||||||
|
|
||||||
|
Warning: no access to tty (Bad file descriptor).
|
||||||
|
Thus no job control in this shell.
|
||||||
|
CSH Path before: /bin:/usr/bin with no parallel
|
||||||
|
parallel: Command not found.
|
||||||
|
^^^^^^^^ Not found is OK
|
||||||
|
/bin:/usr/bin:/tmp OK
|
||||||
|
|
Loading…
Reference in a new issue