Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Wrapper library over paramiko to allow remote execution of tasks. Supports parallel execution on multiple hosts

Project description

Small wrapper library over paramiko that allows for parallel execution of SSH commands on remote hosts and executing simple single host commands over SSH.

parallel-ssh uses asychronous network requests, there is no multi-threading or multi-processing used. This is a requirement for commands on many (hundreds) of hosts which would grind a system to a halt simply by having so many processes/threads all wanting to execute if done with multi-threading/processing.

https://api.travis-ci.org/pkittenis/parallel-ssh.png?branch=master

Module documentation can be found at the repository’s github pages.

Installation

Note

libevent-dev package is no longer required as of gevent 1.0 which has migrated to libev. parallel-ssh now requires at least gevent version 1.0.

$ pip install parallel-ssh

Usage Examples

See documentation on github pages for more complete examples

Run ls on two remote hosts in parallel.

>>> from pssh import ParallelSSHClient
>>> hosts = ['myhost1', 'myhost2']
>>> client = ParallelSSHClient(hosts)
>>> cmds = client.exec_command('ls -ltrh /tmp/aasdfasdf', sudo = True)
>>> print [client.get_stdout(cmd) for cmd in cmds]
[localhost]     drwxr-xr-x  6 xxx xxx 4.0K Jan  1 00:00 xxx
[{'localhost': {'exit_code': 0}}]

SFTP support

SFTP is supported (scp version 2 protocol) natively, no scp command used.

For example to copy a local file to remote hosts in parallel

>>> from pssh import ParallelSSHClient
>>> hosts = ['myhost1', 'myhost2']
>>> client = ParallelSSHClient(hosts)
>>> client.copy_file('../test', 'test_dir/test')
>>> client.pool.join()
Copied local file ../test to remote destination myhost1:test_dir/test
Copied local file ../test to remote destination myhost2:test_dir/test

Project details


Release history Release notifications

History Node

1.7.0

History Node

1.6.3

History Node

1.6.2

History Node

1.6.1

History Node

1.6.0

History Node

1.5.5

History Node

1.5.4

History Node

1.5.2

History Node

1.5.1

History Node

1.5.0

History Node

1.4.0

History Node

1.3.2

History Node

1.3.1

History Node

1.3.0

History Node

1.2.1.post3

History Node

1.2.1.post2

History Node

1.2.1.post1

History Node

1.2.0

History Node

1.2.0b1

History Node

1.1.1

History Node

1.1.0

History Node

1.0.2

History Node

1.0.1

History Node

1.0.0

History Node

1.0.0b4

History Node

1.0.0b3

History Node

1.0.0b2

History Node

1.0.0b1

History Node

0.94.0

History Node

0.93.0

History Node

0.92.2

History Node

0.92.1

History Node

0.91.2

History Node

0.91.1

History Node

0.91.0

History Node

0.90.0

History Node

0.80.7

History Node

0.80.6.post1

History Node

0.80.6

History Node

0.80.5

History Node

0.80.3

History Node

0.80.2

History Node

0.80.1

History Node

0.70.4

History Node

0.70.3

History Node

0.70.2

History Node

0.70.1

History Node

0.70

History Node

0.61

History Node

0.7

History Node

0.6

This version
History Node

0.5

History Node

0.4

History Node

0.3

History Node

0.2

History Node

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
parallel-ssh-0.5.tar.gz (7.0 kB) Copy SHA256 hash SHA256 Source None Aug 13, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page