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.
- Design And Goals
- Clients Feature Comparison
- Advanced Usage
- Change Log
- API Documentation
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)
<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
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
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.
2.x.x onwards, the
ssh2-python based clients will become the default, replacing the current
pssh_client.ParallelSSHClient, with the current clients renamed.