mlos_bench.services.remote.ssh.ssh_fileshare

A collection functions for interacting with SSH servers as file shares.

Classes

CopyMode

Copy mode enum.

SshFileShareService

A collection of functions for interacting with SSH servers as file shares.

Module Contents

class mlos_bench.services.remote.ssh.ssh_fileshare.CopyMode(*args, **kwds)[source]

Bases: enum.Enum

Copy mode enum.

DOWNLOAD = 1[source]
UPLOAD = 2[source]
class mlos_bench.services.remote.ssh.ssh_fileshare.SshFileShareService(config: Dict[str, Any] | None = None, global_config: Dict[str, Any] | None = None, parent: mlos_bench.services.base_service.Service | None = None, methods: Dict[str, Callable] | List[Callable] | None = None)[source]

Bases: mlos_bench.services.base_fileshare.FileShareService, mlos_bench.services.remote.ssh.ssh_service.SshService

A collection of functions for interacting with SSH servers as file shares.

Create a new file share with a given config.

Parameters:
  • config (dict) – Free-format dictionary that contains the file share configuration. It will be passed as a constructor parameter of the class specified by class_name.

  • global_config (dict) – Free-format dictionary of global parameters.

  • parent (Service) – Parent service that can provide mixin functions.

  • methods (Union[Dict[str, Callable], List[Callable], None]) – New methods to register with the service.

download(params: dict, remote_path: str, local_path: str, recursive: bool = True) None[source]

Downloads contents from a remote share path to a local path.

Parameters:
  • params (dict) – Flat dictionary of (key, value) pairs of (optional) connection details.

  • remote_path (str) – Path to download from the remote file share, a file if recursive=False or a directory if recursive=True.

  • local_path (str) – Path to store the downloaded content to.

  • recursive (bool) – If False, ignore the subdirectories; if True (the default), download the entire directory tree.

Return type:

None

upload(params: dict, local_path: str, remote_path: str, recursive: bool = True) None[source]

Uploads contents from a local path to remote share path.

Parameters:
  • params (dict) – Flat dictionary of (key, value) pairs of (optional) connection details.

  • local_path (str) – Path to the local directory to upload contents from.

  • remote_path (str) – Path in the remote file share to store the uploaded content to.

  • recursive (bool) – If False, ignore the subdirectories; if True (the default), upload the entire directory tree.

Return type:

None