parallel: Fix --filter-hosts -S :.

--controlmaster: Kill remote sleep 100000000.
This commit is contained in:
Ole Tange 2014-03-31 21:29:47 +02:00
parent 19bdd17c63
commit 8078bda2bb
3 changed files with 24 additions and 3 deletions

View file

@ -221,6 +221,8 @@ New in this release:
* GNU Parallel was used (unfortunately with improper citation) in: Perspectives in magnetic resonance: NMR in the post-FFT era http://www.sciencedirect.com/science/article/pii/S1090780713003054 * GNU Parallel was used (unfortunately with improper citation) in: Perspectives in magnetic resonance: NMR in the post-FFT era http://www.sciencedirect.com/science/article/pii/S1090780713003054
* Speeding Up Grep Log Queries with GNU Parallel http://www.cybersecurity.io/speeding-grep-queries-gnu-parallel/
* How to run tbss_2_reg in parallel http://tadpolebrainimaging.blogspot.dk/2014/03/how-to-run-tbss2reg-in-parallel.html * How to run tbss_2_reg in parallel http://tadpolebrainimaging.blogspot.dk/2014/03/how-to-run-tbss2reg-in-parallel.html
* Iterative DNS Brute Forcing http://www.room362.com/blog/2014/02/19/iterative-dns-brute-forcing/ * Iterative DNS Brute Forcing http://www.room362.com/blog/2014/02/19/iterative-dns-brute-forcing/

View file

@ -1969,6 +1969,7 @@ sub cleanup_basefile {
sub filter_hosts { sub filter_hosts {
my(@cores, @cpus, @maxline, @echo); my(@cores, @cpus, @maxline, @echo);
while (my ($host, $sshlogin) = each %Global::host) { while (my ($host, $sshlogin) = each %Global::host) {
if($host eq ":") { next }
# The 'true' is used to get the $host out later # The 'true' is used to get the $host out later
my $sshcmd = "true $host;" . $sshlogin->sshcommand()." ".$sshlogin->serverlogin(); my $sshcmd = "true $host;" . $sshlogin->sshcommand()." ".$sshlogin->serverlogin();
push(@cores, $host."\t".$sshcmd." ".$Global::envvar." parallel --number-of-cores\n"); push(@cores, $host."\t".$sshcmd." ".$Global::envvar." parallel --number-of-cores\n");
@ -2063,6 +2064,7 @@ sub filter_hosts {
@down_hosts and ::warning("Removed @down_hosts\n"); @down_hosts and ::warning("Removed @down_hosts\n");
$Global::minimal_command_line_length = 8_000_000; $Global::minimal_command_line_length = 8_000_000;
while (my ($sshlogin, $obj) = each %Global::host) { while (my ($sshlogin, $obj) = each %Global::host) {
if($sshlogin eq ":") { next }
$ncpus{$sshlogin} or ::die_bug("ncpus missing: ".$obj->serverlogin()); $ncpus{$sshlogin} or ::die_bug("ncpus missing: ".$obj->serverlogin());
$ncores{$sshlogin} or ::die_bug("ncores missing: ".$obj->serverlogin()); $ncores{$sshlogin} or ::die_bug("ncores missing: ".$obj->serverlogin());
$time_to_login{$sshlogin} or ::die_bug("time_to_login missing: ".$obj->serverlogin()); $time_to_login{$sshlogin} or ::die_bug("time_to_login missing: ".$obj->serverlogin());
@ -3828,7 +3830,7 @@ sub sshcommand_of_sshlogin {
$serverlogin = $self->{'string'}; $serverlogin = $self->{'string'};
# OpenSSH_3.6.1p2 gives 'tcgetattr: Invalid argument' with -tt # OpenSSH_3.6.1p2 gives 'tcgetattr: Invalid argument' with -tt
# 2>/dev/null to ignore "process_mux_new_session: tcgetattr: Invalid argument" # 2>/dev/null to ignore "process_mux_new_session: tcgetattr: Invalid argument"
my $master = "ssh -MTS $control_path $serverlogin sleep 1000000000 2>/dev/null"; my $master = "ssh -tt -MTS $control_path $serverlogin sleep 1000000000 2>/dev/null";
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
# Start it # Start it

View file

@ -72,10 +72,27 @@ B<xargs>. If I<command> is not given GNU B<parallel> will behave
similar to B<cat | sh>. similar to B<cat | sh>.
The I<command> must be an executable, a script, a composed command, or The I<command> must be an executable, a script, a composed command, or
a function. If it is a Bash function you need to B<export -f> the a function.
If it is a Bash function you need to B<export -f> the
function first. An alias will, however, not work (see why function first. An alias will, however, not work (see why
http://www.perlmonks.org/index.pl?node_id=484296). http://www.perlmonks.org/index.pl?node_id=484296).
If it is a zsh function you will need to use this helper function
B<exportf> to export and to set $SHELL to bash:
function exportf (){
export $(echo $1)="`whence -f $1 | sed -e "s/$1 //" `"
}
function my_func(){
echo $1;
echo "hello";
}
exportf my_func
SHELL=/bin/bash parallel "my_func {}" ::: 1 2
=item B<{}> =item B<{}>
@ -510,7 +527,7 @@ environment that the command is run in. This is especially useful for
remote execution. remote execution.
In Bash I<var> can also be a Bash function - just remember to B<export In Bash I<var> can also be a Bash function - just remember to B<export
-f> the function. -f> the function, see B<command>.
The variable '_' is special. It will copy all enviroment variables The variable '_' is special. It will copy all enviroment variables
except for the ones mentioned in ~/.parallel/ignored_vars. except for the ones mentioned in ~/.parallel/ignored_vars.