in reply to Re: Net::SSH2 not thread safe?
in thread Net::SSH2 not thread safe?

Thanks for the answer, however parallel would slow things down considerably. I need to control the number of threads spawned, thus I would need to pass it into pssh in batches of $threads. Running parallel I would then need to wait for all of them to finish before sending a new batch. The completion time of the commands on each node can vary with factor 10 or more.

I'll keep this in mind for a future project tho, the code is significantly easier than the threading. :-)

-Jesper

Replies are listed 'Best First'.
Re^3: Net::SSH2 not thread safe?
by salva (Canon) on Nov 06, 2011 at 18:00 UTC
    I need to control the number of threads spawned, thus I would need to pass it into pssh in batches of $threads.
    Net::OpenSSH::Parallel already does that for you. For instance, if you want to limit the number of SSH connections to 10, you can use:
    my $pssh = Net::OpenSSH::Parallel->new(connections => 10);