You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+34-31Lines changed: 34 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ Installation
29
29
30
30
pip install parallel-ssh
31
31
32
-
As of version ``0.93.0`` pip version >= ``6.0.0`` is required for Python 2.6 compatibility with newer versions of gevent which have dropped 2.6 support. This limitation will be removed post ``1.0.0`` releases which will deprecate ``2.6`` support.
32
+
As of version ``0.93.0`` pip version >= ``6.0.0`` is required for Python 2.6 compatibility with latest versions of gevent which have dropped 2.6 support. This limitation will be removed post ``1.0.0`` releases which will deprecate ``2.6`` support.
33
33
34
34
To upgrade ``pip`` run the following - use of ``virtualenv`` is recommended so as not to override system provided packages::
35
35
@@ -77,18 +77,22 @@ Exit codes become available once stdout/stderr is iterated on or ``client.join(o
77
77
0
78
78
0
79
79
80
-
The client's join function can be used to block and wait for all parallel commands to finish *if output is not needed*. ::
80
+
The client's ``join`` function can be used to block and wait for all parallel commands to finish::
81
81
82
82
client.join(output)
83
83
84
-
Similarly, if only exit codes are needed but not output ::
84
+
Similarly, exit codes are available after ``client.join`` is called::
85
85
86
86
output = client.run_command('exit 0')
87
87
# Block and gather exit codes. Output variable is updated in-place
88
88
client.join(output)
89
89
print(output[client.hosts[0]]['exit_code'])
90
90
0
91
91
92
+
.. note::
93
+
94
+
In versions prior to ``1.0.0`` only, ``client.join`` would consume standard output.
95
+
92
96
There is also a built in host logger that can be enabled to log output from remote hosts. The helper function ``pssh.utils.enable_host_logger`` will enable host logging to stdout, for example ::
93
97
94
98
import pssh.utils
@@ -128,6 +132,30 @@ On the other end of the spectrum, long lived remote commands that generate *no*
128
132
129
133
Output *generation* is done remotely and has no effect on the event loop until output is gathered - output buffers are iterated on. Only at that point does the event loop need to be held.
130
134
135
+
********
136
+
SFTP/SCP
137
+
********
138
+
139
+
SFTP is supported (SCP version 2) natively, no ``scp`` command required.
140
+
141
+
For example to copy a local file to remote hosts in parallel::
Copied local file ../test to remote destination myhost1:test_dir/test
153
+
Copied local file ../test to remote destination myhost2:test_dir/test
154
+
155
+
There is similar capability to copy remote files to local ones suffixed with the host's name with the ``copy_remote_file`` function.
156
+
157
+
Directory recursion is supported in both cases via the ``recurse`` parameter - defaults to off.
158
+
131
159
**************************
132
160
Frequently asked questions
133
161
**************************
@@ -138,15 +166,15 @@ Frequently asked questions
138
166
:A:
139
167
In short, the tools are intended for different use cases.
140
168
141
-
``ParallelSSH`` satisfies uses cases for a parallel SSH client library that scales well over hundreds to hundreds of thousands of hosts - per `Design And Goals`_ - a use case that is very common on cloud platforms and virtual machine automation. It would be best used where it is a good fit for the use case.
169
+
``ParallelSSH`` satisfies uses cases for a parallel SSH client library that scales well over hundreds to hundreds of thousands of hosts - per `Design And Goals`_ - a use case that is very common on cloud platforms and virtual machine automation. It would be best used where it is a good fit for the use case at hand.
142
170
143
-
Fabric and tools like it on the other hand are not well suited to such use cases, for many reasons, performance and differing design goals in particular. The similarity is only that these tools also make use of SSH to run their commands.
171
+
Fabric and tools like it on the other hand are not well suited to such use cases, for many reasons, performance and differing design goals in particular. The similarity is only that these tools also make use of SSH to run commands.
144
172
145
173
``ParallelSSH`` is in other words well suited to be the SSH client tools like Fabric and Ansible and others use to run their commands rather than a direct replacement for.
146
174
147
175
By focusing on providing a well defined, lightweight - actual code is a few hundred lines - library, ``ParallelSSH`` is far better suited for *run this command on X number of hosts* tasks for which frameworks like Fabric, Capistrano and others are overkill and unsuprisignly, as it is not what they are for, ill-suited to and do not perform particularly well with.
148
176
149
-
Fabric and tools like it are high level deployment frameworks - as opposed to general purpose libraries - for building deployment tasks to perform on hosts matching a role with task chaining and a DSL like syntax and are primarily intended for command line use for which the framework is a good fit for - very far removed from an SSH client library.
177
+
Fabric and tools like it are high level deployment frameworks - as opposed to general purpose libraries - for building deployment tasks to perform on hosts matching a role with task chaining, a DSL like syntax and are primarily intended for command line use for which the framework is a good fit for - very far removed from an SSH client *library*.
150
178
151
179
Fabric in particular is a port of `Capistrano <https://github.com/capistrano/capistrano>`_ from Ruby to Python. Its design goals are to provide a faithful port of Capistrano with its `tasks` and `roles` framework to python with interactive command line being the intended usage.
152
180
@@ -205,28 +233,3 @@ Frequently asked questions
205
233
206
234
:A:
207
235
There is a public `ParallelSSH Google group <https://groups.google.com/forum/#!forum/parallelssh>`_ setup for this purpose - both posting and viewing are open to the public.
208
-
209
-
210
-
********
211
-
SFTP/SCP
212
-
********
213
-
214
-
SFTP is supported (SCP version 2) natively, no ``scp`` command required.
215
-
216
-
For example to copy a local file to remote hosts in parallel::
Copy file name to clipboardExpand all lines: pssh/__init__.py
+5-7Lines changed: 5 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -17,17 +17,16 @@
17
17
# License along with this library; if not, write to the Free Software
18
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
19
20
-
"""Asynchronous parallel SSH library
20
+
"""Asynchronous parallel SSH client library.
21
21
22
-
parallel-ssh uses asychronous network requests - there is *no* multi-threading nor multi-processing used.
22
+
Run SSH commands over many - hundreds/hundreds of thousands - number of servers asynchronously and with minimal system load on the client host.
23
23
24
-
This is a *requirement* for commands on many (hundreds/thousands/hundreds of thousands) 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.
24
+
New users should start with :py:func:`pssh.pssh_client.ParallelSSHClient.run_command`
25
25
26
-
The `libev event loop library <http://software.schmorp.de/pkg/libev.html>`_ is utilised on nix systems. Windows is not supported.
27
-
28
-
See :mod:`pssh.ParallelSSHClient` and :mod:`pssh.SSHClient` for class documentation.
26
+
See also :py:class:`pssh.ParallelSSHClient` and :py:class:mod:`pssh.SSHClient` for class documentation.
0 commit comments