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
+41-35Lines changed: 41 additions & 35 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 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.
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
@@ -47,31 +47,27 @@ Run ``ls`` on two remote hosts in parallel with ``sudo``.
Stdout and stderr buffers are available in output. Iterating on them can be used to get output as it becomes available. Iteration ends *only when command has finished*, though it may be interrupted and resumed at any point.
68
+
Standard output buffers are available in output object. Iterating on them can be used to get output as it becomes available. Iteration ends *only when command has finished*, though it may be interrupted and resumed at any point.
69
+
70
+
`Host output <http://parallel-ssh.readthedocs.io/en/latest/output.html>`_ attributes are available in per-host output dictionary, for example ``output['myhost1'].stdout``.
75
71
76
72
::
77
73
@@ -83,7 +79,7 @@ Stdout and stderr buffers are available in output. Iterating on them can be used
Exit codes become available once stdout/stderr is iterated on or ``client.join(output)`` is called.
82
+
Exit codes become available once output is iterated on to completion *or* ``client.join(output)`` is called.
87
83
88
84
::
89
85
@@ -96,13 +92,17 @@ The client's ``join`` function can be used to block and wait for all parallel co
96
92
97
93
client.join(output)
98
94
99
-
Similarly, exit codes are available after ``client.join`` is called::
95
+
Similarly, output and exit codes are available after ``client.join`` is called::
100
96
101
97
output = client.run_command('exit 0')
102
98
# Block and gather exit codes. Output is updated in-place
103
99
client.join(output)
104
-
pprint(output[client.hosts[0]].exit_code)
100
+
pprint(output.values()[0].exit_code)
105
101
0
102
+
# Output is available
103
+
for line in output.values()[0].stdout:
104
+
pprint(line)
105
+
<..stdout..>
106
106
107
107
.. note::
108
108
@@ -171,6 +171,8 @@ There is similar capability to copy remote files to local ones suffixed with the
171
171
172
172
Directory recursion is supported in both cases via the ``recurse`` parameter - defaults to off.
173
173
174
+
See `copy_file <http://parallel-ssh.readthedocs.io/en/latest/pssh_client.html#pssh.pssh_client.ParallelSSHClient.copy_file>`_ and `copy_remote_file <http://parallel-ssh.readthedocs.io/en/latest/pssh_client.html#pssh.pssh_client.ParallelSSHClient.copy_remote_file>`_ documentation for more examples.
175
+
174
176
**************************
175
177
Frequently asked questions
176
178
**************************
@@ -195,56 +197,60 @@ Frequently asked questions
195
197
196
198
Furthermore, Fabric's use as a library is non-standard and in `many <https://github.com/fabric/fabric/issues/521>`_ `cases <https://github.com/fabric/fabric/pull/674>`_ `just <https://github.com/fabric/fabric/pull/1215>`_ `plain <https://github.com/fabric/fabric/issues/762>`_ `broken <https://github.com/fabric/fabric/issues/1068>`_ and currently stands at over 7,000 lines of code most of which is lacking code testing.
197
199
198
-
In addition, Fabric's parallel command implementation uses a combination of both threads and processes with extremely high CPU usage and system load while running with as little as tens of hosts.
200
+
In addition, Fabric's parallel command implementation uses a combination of both threads and processes with extremely high CPU usage and system load while running with as little as hosts in the single digits.
199
201
200
202
:Q:
201
-
Is Windows supported?
203
+
Is Windows supported?
202
204
203
205
:A:
204
-
The library installs and works on Windows though not formally supported as unit tests are currently Posix system based.
206
+
The library installs and works on Windows though not formally supported as unit tests are currently Posix system based.
205
207
206
-
Pip versions >= 8.0 are required for binary package installation of ``gevent`` on Windows, a dependency of ``ParallelSSH``.
208
+
Pip versions >= 8.0 are required for binary package installation of ``gevent`` on Windows, a dependency of ``ParallelSSH``.
207
209
208
-
Though ``ParallelSSH`` is pure python code and will run on any platform that has a working Python interpreter, its ``gevent`` dependency contains native code which either needs a binary package to be provided for the platform or to be built from source. Binary packages for ``gevent`` are provided for OSX, Linux and Windows platforms as of this time of writing.
210
+
Though ``ParallelSSH`` is pure python code and will run on any platform that has a working Python interpreter, its ``gevent`` dependency and certain dependencies of ``paramiko`` contain native code which either needs a binary package to be provided for the platform or to be built from source. Binary packages for ``gevent`` are provided for OSX, Linux and Windows platforms as of this time of writing.
209
211
210
212
:Q:
211
-
Are SSH agents used?
213
+
Are SSH agents used?
212
214
213
215
:A:
214
-
All available keys in a system configured SSH agent in addition to SSH keys in the user's home directory, `~/.ssh/id_dsa`, `~/.ssh/id_rsa` et al are automatically used by ParallelSSH.
216
+
All available keys in a system configured SSH agent in addition to SSH keys in the user's home directory, `~/.ssh/id_dsa`, `~/.ssh/id_rsa` et al are automatically used by ParallelSSH.
215
217
216
-
Use of SSH agent can be disabled by creating a client as ``ParallelSSHClient(allow_agent=False)``. `See documentation <http://parallel-ssh.readthedocs.org/en/latest/>`_ for more information.
218
+
Use of SSH agent can be disabled by creating a client as ``ParallelSSHClient(allow_agent=False)``. `See documentation <http://parallel-ssh.readthedocs.org/en/latest/>`_ for more information.
217
219
218
220
:Q:
219
-
Can ParallelSSH forward my SSH agent?
221
+
Can ParallelSSH forward my SSH agent?
220
222
221
223
:A:
222
-
SSH agent forwarding, what ``ssh -A`` does on the command line, is supported and enabled by default. Creating an object as ``ParallelSSHClient(forward_ssh_agent=False)`` will disable this behaviour.
224
+
SSH agent forwarding, what ``ssh -A`` does on the command line, is supported and enabled by default. Creating an object as ``ParallelSSHClient(forward_ssh_agent=False)`` will disable this behaviour.
223
225
224
226
:Q:
225
-
Is tunneling/proxying supported?
227
+
Is tunneling/proxying supported?
226
228
227
229
:A:
228
-
Yes, `ParallelSSH` natively supports tunelling - also known as proxying - through an intermediate SSH server. Connecting to a remote host is accomplished via an SSH tunnel using the SSH's protocol direct TCP tunneling feature, using local port forwarding. This is done natively in python and tunnel connections are asynchronous like all other connections in the `ParallelSSH` library. For example, client -> proxy SSH server -> remote SSH destination.
230
+
Yes, `ParallelSSH` natively supports tunelling - also known as proxying - through an intermediate SSH server. Connecting to a remote host is accomplished via an SSH tunnel using the SSH's protocol direct TCP tunneling feature, using local port forwarding. This is done natively in python and tunnel connections are asynchronous like all other connections in the `ParallelSSH` library. For example, client -> proxy SSH server -> remote SSH destination.
229
231
230
-
Use the ``proxy_host`` and ``proxy_port`` parameters to configure your proxy::
232
+
Use the ``proxy_host`` and ``proxy_port`` parameters to configure your proxy::
Note that while connections from the ParallelSSH `client` to the tunnel host are asynchronous, connections from the tunnel host to the remote destination(s) may not be, depending on the SSH server implementation. If the SSH server uses threading to implement its tunelling and that server is used to tunnel to a large number of remote destinations system load on the tunnel server will increase linearly with number of threads used.
236
+
Note that while connections from the ParallelSSH `client` to the tunnel host are asynchronous, connections from the tunnel host to the remote destination(s) may not be, depending on the SSH server implementation. If the SSH server uses threading to implement its tunelling and that server is used to tunnel to a large number of remote destinations system load on the tunnel server will increase linearly with number of threads used.
235
237
236
238
:Q:
237
-
Is there a way to programmatically provide an SSH key?
239
+
Is there a way to programmatically provide an SSH key?
238
240
239
241
:A:
240
-
Yes, use the ``pkey`` parameter of the `ParallelSSHClient class <http://parallel-ssh.readthedocs.org/en/latest/#pssh.ParallelSSHClient>`_. There is a ``load_private_key`` helper function in ``pssh.utils`` that can be used to load any supported key type. For example::
242
+
Yes, use the ``pkey`` parameter of the `ParallelSSHClient class`_. There is also a ``load_private_key`` helper function in ``pssh.utils`` that can be used to load any supported key type. See `ParallelSSHClient class`_ documentation for examples.
243
+
244
+
:Q:
245
+
Is there a way to programmatically provide an SSH agent?
Yes, with the ``SSHAgent`` class that can be provided via the ``agent`` class parameter of `ParallelSSHClient class`_. Supplying an agent object in this way overrides use of the system's SSH agent, if any. See `SSHAgent documentation <http://parallel-ssh.readthedocs.io/en/latest/agent.html>`_ for an example.
245
249
246
250
:Q:
247
251
Is there a user's group for feedback and discussion about ParallelSSH?
248
252
249
253
:A:
250
254
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.
0 commit comments