hscp module¶
-
exception
hscp.
Error
¶ Bases:
exceptions.Exception
-
class
hscp.
RemoteLogin
(machine, user, ssh_key_path)¶ Bases:
object
Contains information about how to log in to the remote machine.
-
hscp.
bundleAndCopyFilesToRemoteMachine
(local_file_paths, local_base_directory, remote_login, remote_base_directory, update_callback, archive_prefix='')¶ Gather local files into a compressed archive, send it to a remote machine using passwordless scp, and extract it there.
- The temporary archive is deleted from both the local and remote machines.
- The parts of the local file paths relative to local_base_directory are copied to the remote machine in remote_base_directory.
- If archive_prefix is given, entries in the archive are prepended with it. This parameter effectively lets you prepend directories to remote_base_directory that may not yet exist on the remote machine.
- The update callback is invoked with four parameters: the current status type, the total upload size, the transfer fraction complete, and a string describing the estimated time remaining. Note that if the status type is ERROR, the total upload size contains an error message.
-
hscp.
copyBundledFilesToRemoteMachine
(tar_path, remote_login, remote_base_directory, update_callback, delete_tarball=False)¶ Copy a bz2 archive to a remote machine and extract it.
The local bz2 archive is optionally deleted. See bundleAndCopyFilesToRemoteMachine for a description of the other parameters.
-
hscp.
copyFileFromRemoteMachine
(remote_login, remote_file_path, local_file_path, progress_callback=None)¶ Use scp to copy a file from a remote machine using a passwordless login.
See copyFileToRemoteMachine for more information.
-
hscp.
copyFileToRemoteMachine
(local_file_path, remote_login, remote_directory, progress_callback=None)¶ Use scp to copy a file to a remote machine using a passwordless login.
progress_callback: This callback is invoked with a fraction complete and a string containing an estimated duration until completion. If you’re not using the update callback then you probably don’t need to use this module; just invoke the scp command.
-
hscp.
createBZ2Archive
(file_paths, base_directory, archive_prefix='', tar_path=None)¶ Create a bz2 archive file.
file_paths: A sequence of full paths to the files going in the archive. base_directory: Entries in the archive are relative to this directory.
Each of the entries in file_paths must start with this directory.- archive_prefix: If given, entries in the archive are prepended with it.
- This parameter effectively lets you prepend directories to each file in the archive.
- tar_path: The path to the archive file to create. If it is None, a path
- to a temporary file is used.