parallel-ssh, imported as `pssh`, is an asynchronous Python library for executing commands and transferring files over SSH to multiple hosts in parallel. It leverages `asyncio` for high-performance operations, making it suitable for managing large clusters or performing fast, concurrent remote tasks. The current version is 2.16.0.post1, and it maintains a relatively active release cadence with minor updates every few months.
pip install parallel-sshVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates connecting to multiple hosts using `ParallelSSHClient` and executing a command. It uses `asyncio` to run the asynchronous operations. Replace `hostname1`, `hostname2`, and `your_user` with your actual host details and username. For authentication, consider using SSH agents, `known_hosts`, or passing credentials/private key paths to the client.
Upgrade your Python environment to 3.8 or newer if you are using `parallel-ssh` version 2.13.0 or later.
Remove explicit calls to `SSHClient.disconnect()`. The client will handle resource cleanup automatically. Relying on explicit calls will not close the connection and may lead to resource leaks.
To enable compression, explicitly pass `compress=True` when initializing `SSHClient`, `ParallelSSHClient`, or `HostConfig` (e.g., `ParallelSSHClient(hosts, compress=True)`).
Always use `from pssh.clients import ParallelSSHClient` (or `import pssh`) to import the library components.
Change your import statements from `import parallel_ssh` (or similar) to `import pssh` or `from pssh.clients import ParallelSSHClient`.
Ensure you are calling `parallel-ssh` methods with the `await` keyword within an `async` function, and that your main script is run via `asyncio.run()`.
Verify the `user`, `password`, `pkey`, and `passphrase` arguments passed to your `SSHClient` or `ParallelSSHClient`. Ensure target hosts' public keys are correctly added to your `~/.ssh/known_hosts` file, or consider explicitly disabling strict host key checking for development (not recommended for production).
To enable debug mode, set the environment variable `PYTHONASYNCIODEBUG=1` before running your script, or call `asyncio.get_event_loop().set_debug(True)` early in your program.
No dependency data recorded yet.