rcluster.pmkutils module¶
pmkutils
collects the functions used to interact with remote
AWS servers using paramiko.client.SSHClient
and
paramiko.sftp_client.SFTPClient
objects.
-
rcluster.pmkutils.
_filesFromWalk
(gen)[source]¶ Talk a generator yielding root, dirs, files (as from os.walk()) and return a list of all files (with fully qualified paths).
Parameters: gen (generator) – Generator yielding root, dirs, files (as from os.walk()) Returns:
-
rcluster.pmkutils.
_thread_jobs
(func, client, files)[source]¶ An internal utility for threading put/get actions.
Parameters: - files (list) – A list containing two-tuples of (orig, dest)
- func (function) – Either sftp_conn.get or sftp_conn.put
Returns:
-
rcluster.pmkutils.
_unixPath
(*args)[source]¶ Most handle UNIX pathing, not vice versa, enforce standard
-
rcluster.pmkutils.
cpuCount
(client)[source]¶ Given a
paramiko.client.SSHClient
object, return the remote’s CPU count
-
rcluster.pmkutils.
pmkCmd
(client, call)[source]¶ Issue command over SSH, treat execution failure as program failure.
Parameters: - client –
paramiko.client.SSHClient
class object - call – String of shell command to be executed
- client –
-
rcluster.pmkutils.
pmkConnect
(host, key_path, username='ubuntu')[source]¶ Create SSH connection to host, retrying on failure.
Parameters: - host – The address of the remote server
- key_path – The location of the key pair file
- username – The username to access on the remote server
-
rcluster.pmkutils.
pmkGet
(client, sources, target, threaded=True)[source]¶ Copy local files to remote target. Directories are copied recursively when provided as the source. Will do nothing if source does not exist.
Parameters: - client –
paramiko.client.SSHClient
object - sources – The local data source
- target – The remote data destination
- client –
-
rcluster.pmkutils.
pmkPut
(client, sources, target, threaded=True)[source]¶ Copy local files to remote target. Directories are copied recursively when provided as the source. Will do nothing if source does not exist.
Parameters: - client –
paramiko.client.SSHClient
object - sources – The local data source
- target – The remote data destination
- client –
-
rcluster.pmkutils.
pmkWalk
(sftp_conn, root)[source]¶ paramiko os.walk() equivalent.
Parameters: - sftp_conn –
paramiko.sftp_client.SFTPClient
object - dir – Remote directory targeted
- sftp_conn –