API documentation for common parallel client functionality.
This class is abstract and contains functions that need to be implemented for each underlying SSH library.
Abstract parallel SSH client package
Parallel client base class.
Connect to and authenticate with all hosts in parallel.
This function can be used to perform connection and authentication outside of command functions like run_command
or copy_file
so the two operations, login and running a remote command, can be separated.
It is not required to be called prior to any other functions.
Connections and authentication is performed in parallel by this and all other functions.
list of greenlets to joinall
with.
list(gevent.greenlet.Greenlet
)
Copy local file to remote file in parallel
This function returns a list of greenlets which can be join-ed on to wait for completion.
gevent.joinall()
function may be used to join on all greenlets and will also raise exceptions from them if called with raise_error=True
- default is False.
Alternatively call .get on each greenlet to raise any exceptions from it.
Exceptions listed here are raised when either gevent.joinall(<greenlets>, raise_error=True)
is called or .get
is called on each greenlet, not this function itself.
local_file (str) – Local filepath to copy to remote host
remote_file (str) – Remote filepath on remote host to copy file to
recurse (bool) – Whether or not to descend into directories recursively.
copy_args (tuple or list) – (Optional) format local_file and remote_file strings with per-host arguments in copy_args
. copy_args
length must equal length of host list - pssh.exceptions.HostArgumentError
is raised otherwise
List(gevent.Greenlet
) of greenlets for remote copy commands
ValueError
when a directory is supplied to local_file and recurse is not set
pssh.exceptions.HostArgumentError
on number of per-host copy arguments not equal to number of hosts
IOError
on I/O errors writing files
OSError
on OS errors like permission denied
Note
Remote directories in remote_file that do not exist will be created as long as permissions allow.
Copy remote file(s) in parallel as <local_file><suffix_separator><host>
With a local_file
value of myfile
and default separator _
the resulting filename will be myfile_myhost
for the file from host myhost
.
This function, like ParallelSSHClient.copy_file()
, returns a list of greenlets which can be join-ed on to wait for completion.
gevent.joinall()
function may be used to join on all greenlets and will also raise exceptions if called with raise_error=True
- default is False.
Alternatively call .get on each greenlet to raise any exceptions from it.
Exceptions listed here are raised when either gevent.joinall(<greenlets>, raise_error=True)
is called or .get
is called on each greenlet, not this function itself.
remote_file (str) – remote filepath to copy to local host
local_file (str) – local filepath on local host to copy file to
recurse (bool) – whether or not to recurse
suffix_separator (str) – (Optional) Separator string between filename and host, defaults to _
. For example, for a local_file
value of myfile
and default separator the resulting filename will be myfile_myhost
for the file from host myhost
. suffix_separator
has no meaning if copy_args
is provided
copy_args (tuple or list) – (Optional) Format remote_file and local_file strings with per-host arguments in copy_args
. copy_args
length must equal length of host list - pssh.exceptions.HostArgumentError
is raised otherwise
list(gevent.Greenlet
) of greenlets for remote copy commands
ValueError
when a directory is supplied to local_file and recurse is not set
pssh.exceptions.HostArgumentError
on number of per-host copy arguments not equal to number of hosts
IOError
on I/O errors writing files
OSError
on OS errors like permission denied
Note
Local directories in local_file
that do not exist will be created as long as permissions allow.
Note
File names will be de-duplicated by appending the hostname to the filepath separated by suffix_separator
.
Check if commands have finished without blocking.
output (list(HostOutput
)) – (Optional) Output to check if finished. Defaults to get_last_output
Get output for last commands executed by run_command
.
cmds (list(gevent.Greenlet
)) – Commands to get output for. Defaults to client.cmds
list(pssh.output.HostOutput
)
Wait until all remote commands in output have finished. Does not block other commands from running in parallel.
output (HostOutput objects) – Output of commands to join on
consume_output (bool) – Whether or not join should consume output buffers. Output buffers will be empty after join
if set to True
. Must be set to True
to allow host logger to log output on call to join
when host logger has been enabled.
timeout (float) – Timeout in seconds if all remote commands are not yet finished. This function’s timeout is for all commands in total and will therefor be affected by pool size and total number of concurrent commands in self.pool. Since self.timeout is passed onto each individual SSH session it is not used for any parallel functions like run_command or join.
pssh.exceptions.Timeout
on timeout requested and reached with commands still running.
None
Wait for running commands to complete and close shells.
shells (list(pssh.clients.base.single.InteractiveShell
)) – Shells to join on.
timeout (float) – Seconds before waiting for shell commands to finish times out. Defaults to self.timeout if not provided.
pssh.exceptions.Timeout
on timeout requested and reached with commands still running.
Open interactive shells on all hosts.
Run command(s) on shells.
shells (list(pssh.clients.base.single.InteractiveShell
)) – Shells to run on.
commands (list or str) – Commands to run.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4