mlos_bench.services.FileShareService

class mlos_bench.services.FileShareService(config: Dict[str, Any] | None = None, global_config: Dict[str, Any] | None = None, parent: Service | None = None, methods: Dict[str, Callable] | List[Callable] | None = None)

An abstract base of all file shares.

Attributes:
config_loader_service

Return a config loader service.

Methods

download(params, remote_path, local_path[, ...])

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

export()

Return a dictionary of functions available in this service.

merge_methods(ext_methods, local_methods)

Merge methods from the external caller with the local ones.

new(class_name[, config, global_config, parent])

Factory method for a new service with a given config.

pprint()

Produce a human-readable string listing all public methods of the service.

register(services)

Register new mix-in services.

upload(params, local_path, remote_path[, ...])

Uploads contents from a local path to remote share path.

__init__(config: Dict[str, Any] | None = None, global_config: Dict[str, Any] | None = None, parent: Service | None = None, methods: Dict[str, Callable] | List[Callable] | None = None)

Create a new file share with a given config.

Parameters:
configdict

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_configdict

Free-format dictionary of global parameters.

parentService

Parent service that can provide mixin functions.

methodsUnion[Dict[str, Callable], List[Callable], None]

New methods to register with the service.

abstract download(params: dict, remote_path: str, local_path: str, recursive: bool = True) None

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

Parameters:
paramsdict

Flat dictionary of (key, value) pairs of (optional) connection details.

remote_pathstr

Path to download from the remote file share, a file if recursive=False or a directory if recursive=True.

local_pathstr

Path to store the downloaded content to.

recursivebool

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

abstract upload(params: dict, local_path: str, remote_path: str, recursive: bool = True) None

Uploads contents from a local path to remote share path.

Parameters:
paramsdict

Flat dictionary of (key, value) pairs of (optional) connection details.

local_pathstr

Path to the local directory to upload contents from.

remote_pathstr

Path in the remote file share to store the uploaded content to.

recursivebool

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