bug-parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU Parallel Bug Reports --ssh 'autossh' not working and --ssh 'auto


From: Ole Tange
Subject: Re: GNU Parallel Bug Reports --ssh 'autossh' not working and --ssh 'autossh -M {PORT} not expanded
Date: Wed, 23 Sep 2015 21:57:30 +0200

On Wed, Sep 23, 2015 at 2:07 PM, Marco Tamassia
<address@hidden> wrote:
> Ok, that was a bit of a silly example, sorry.

So you want replacement strings to be expanded in --ssh as well:

  --ssh 'ssh -p {= $_=sprintf("2%04d",$job->slot()) =}'

You want the above to connect ssh to port 20000+jobslot.

I do not see a way to do this: ssh is called with out a $job and
without an argument in $_ in at least 2 situations:

* when figuring out the number of cpus, cores, and max line length
* when transferring --basefiles

Can you instead make a wrapper around autossh that grabs a port, uses
it, and releases it again when done. Something like:

   # Get a portnumber
   get_port ()
    {
       perl -e 'chomp(@a=<>);@address@hidden@a;$c=19999;while($b{++$c}){};print
"$c\n";' ports >> ports;
       tail -n1 ports
    }
    export -f get_port

    P=`sem --fg --id port get_port`

    autossh -M $P

    # Free portnumber
    sem --fg --id port "grep -v $P ports > ports.tmp;mv ports.tmp ports"

But really: Why is this not simply part of autossh? -M -1 ought to
mean: Go find a couple of free ports yourself - don't bother me.

Consider filing a few bug report for autossh:

* Find free ports automatically
* Transfer exit code
* Better parser of when options for ssh ends: ssh localhost perl -e
\'"print 1"\'
* Stop using -M as that is used by ssh for connection sharing

Personally I would also like if autossh could retry connecting in a
few deciseconds if it gets: "ssh_exchange_identification: Connection
closed by remote host" which happens quite often when using GNU
Parallel due to the server only being able to have 10 connections in
login-state.


/Ole



reply via email to

[Prev in Thread] Current Thread [Next in Thread]