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:
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:
rcluster.pmkutils.pmkGetFile(client, source_fn, target_fn)[source]
rcluster.pmkutils.pmkGetFiles(client, get_files, threaded=True)[source]
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:
rcluster.pmkutils.pmkPutFile(client, source_fn, target_fn)[source]
rcluster.pmkutils.pmkPutFiles(client, send_files, threaded=True)[source]
rcluster.pmkutils.pmkWalk(sftp_conn, root)[source]

paramiko os.walk() equivalent.

Parameters: