mlos_bench.environments.local.local_fileshare_env

Scheduler-side Environment to run scripts locally and upload/download data to the shared storage.

Classes

LocalFileShareEnv

Scheduler-side Environment that runs scripts locally and uploads/downloads data

Module Contents

class mlos_bench.environments.local.local_fileshare_env.LocalFileShareEnv(*, name: str, config: dict, global_config: dict | None = None, tunables: mlos_bench.tunables.tunable_groups.TunableGroups | None = None, service: mlos_bench.services.base_service.Service | None = None)[source]

Bases: mlos_bench.environments.local.local_env.LocalEnv

Scheduler-side Environment that runs scripts locally and uploads/downloads data to the shared file storage.

Create a new application environment with a given config.

Parameters:
  • name (str) – Human-readable name of the environment.

  • config (dict) – Free-format dictionary that contains the benchmark environment configuration. Each config must have at least the “tunable_params” and the “const_args” sections. LocalFileShareEnv must also have at least some of the following parameters: {setup, upload, run, download, teardown, dump_params_file, read_results_file}

  • global_config (dict) – Free-format dictionary of global parameters (e.g., security credentials) to be mixed in into the “const_args” section of the local config.

  • tunables (TunableGroups) – A collection of tunable parameters for all environments.

  • service (Service) – An optional service object (e.g., providing methods to deploy or reboot a VM, etc.).

run() Tuple[mlos_bench.environments.status.Status, datetime.datetime, Dict[str, mlos_bench.tunables.tunable.TunableValue] | None][source]

Download benchmark results from the shared storage and run post-processing scripts locally.

Returns:

(status, timestamp, output) – 3-tuple of (Status, timestamp, output) values, where output is a dict with the results or None if the status is not COMPLETED. If run script is a benchmark, then the score is usually expected to be in the score field.

Return type:

(Status, datetime.datetime, dict)

setup(tunables: mlos_bench.tunables.tunable_groups.TunableGroups, global_config: dict | None = None) bool[source]

Run setup scripts locally and upload the scripts and data to the shared storage.

Parameters:
  • tunables (TunableGroups) – A collection of tunable OS and application parameters along with their values. In a local environment these could be used to prepare a config file on the scheduler prior to transferring it to the remote environment, for instance.

  • global_config (dict) – Free-format dictionary of global parameters of the environment that are not used in the optimization process.

Returns:

is_success – True if operation is successful, false otherwise.

Return type:

bool

status() Tuple[mlos_bench.environments.status.Status, datetime.datetime, List[Tuple[datetime.datetime, str, Any]]][source]

Check the status of the benchmark environment.

Returns:

(benchmark_status, timestamp, telemetry) – 3-tuple of (benchmark status, timestamp, telemetry) values. timestamp is UTC time stamp of the status; it’s current time by default. telemetry is a list (maybe empty) of (timestamp, metric, value) triplets.

Return type:

(Status, datetime.datetime, list)