composer.utils.object_store.sftp_object_store#

Utility for uploading to and downloading from cloud object stores.

Classes

SFTPObjectStore

Utility for uploading to and downloading to a server via SFTP.

class composer.utils.object_store.sftp_object_store.SFTPObjectStore(host, port=22, username=None, password=None, known_hosts_filename=None, key_filename=None, missing_host_key_policy='RejectPolicy', cwd='', connect_kwargs=None)[source]#

Bases: composer.utils.object_store.object_store.ObjectStore

Utility for uploading to and downloading to a server via SFTP.

Parameters
  • host (str) โ€“

    The server to connect to.

    Also accepts a URI string in the form 'sftp://[email protected]:port/./relative/path'. For an absolute path, use a double // โ€“ e.g. 'sftp://[email protected]:port//absolute/path'.

  • port (int, optional) โ€“ The server port to connect to.

  • username (str, optional) โ€“ The username (if not specified in the SSH config) needed to authenticate. Defaults to None.

  • password (str, optional) โ€“ The password (if required) needed to authenticate. Defaults to None.

  • key_filename (Path | str, optional) โ€“ The filepath to the a private key (if required) needed to authenticate. Defaults to None. Any keys specified here will be tried in addition to any keys specified in ~/.ssh/ or via a SSH agent.

  • known_hosts_filename (Path | str, optional) โ€“ The filename of the known hosts file. If not specified, the default SSH known hosts will be used.

  • missing_host_key_policy (str | paramiko.client.MissingHostKeyPolicy) โ€“

    The class name or instance of paramiko.client.MissingHostKeyPolicy to use for a missing host key. Defaults to 'RejectPolicy'.

    Built-in options: * 'RejectPolicy' (the default), which will reject any host key not authorized in the known_hosts_filename. * 'AutoAddPolicy', which will add any unknown host key. * 'WarningPolicy', which will warn on an unknown host key.

    For custom logic, subclass paramiko.client.MissingHostKeyPolicy, and provide an instance of this class.

  • cwd (str, optional) โ€“ The directory to navigate to upon creating the SSH connection. If not present it will be created.

  • connect_kwargs (Dict[str, Any], optional) โ€“ Any additional kwargs to pass through to SSHClient.connect().