Parallel-SSH Documentation

License Latest Version https://travis-ci.org/ParallelSSH/parallel-ssh.svg?branch=master https://ci.appveyor.com/api/projects/status/github/parallelssh/ssh2-python?svg=true&branch=master https://codecov.io/gh/ParallelSSH/parallel-ssh/branch/master/graph/badge.svg https://img.shields.io/pypi/wheel/parallel-ssh.svg Latest documentation

parallel-ssh is a non-blocking parallel SSH client library.

It uses non-blocking asynchronous SSH sessions and is to date the only publicly available non-blocking SSH client library, as well as the only non-blocking parallel SSH client library available for Python.

In a nutshell

from __future__ import print_function

from pssh.pssh_client import ParallelSSHClient

client = ParallelSSHClient(['localhost'])
output = client.run_command('whoami')
for line in output['localhost'].stdout:
    print(line)
Output:
<your username here>

ssh2-python (libssh2) based clients

As of version 1.2.0, new single host and parallel clients are available based on the libssh2 C library via its ssh2-python wrapper.

They offer significantly enhanced performance and stability, at much less overhead, with a native non-blocking mode meaning no monkey patching of the Python standard library when using them.

To use them, import from pssh2_client or ssh2_client for the parallel and single clients respectively.

from __future__ import print_function

from pssh.pssh2_client import ParallelSSHClient

client = ParallelSSHClient(['localhost'])
output = client.run_command('whoami')
for line in output['localhost'].stdout:
    print(line)

The API is mostly identical to the current clients, though some features are not yet supported. See client feature comparison section for how feature support differs between the two clients.

Note

From version 2.x.x onwards, the ssh2-python based clients will become the default, replacing the current pssh_client.ParallelSSHClient, with the current clients renamed.

Indices and tables