mlos_bench.environments.remote.remote_env

Remotely executed benchmark/script environment.

e.g. Application Environment

TODO: Documentat how variable propogation works in the remote environments.

Classes

RemoteEnv

Environment to run benchmarks and scripts on a remote host OS.

Module Contents

class mlos_bench.environments.remote.remote_env.RemoteEnv(*, 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.script_env.ScriptEnv

Environment to run benchmarks and scripts on a remote host OS.

e.g. Application Environment

Create a new environment for remote execution.

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. RemoteEnv must also have at least some of the following parameters: {setup, run, teardown, wait_boot}

  • 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 Host, VM, OS, etc.).

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

Runs the run script on the remote environment.

This can be used to, for instance, submit a new experiment to the remote application environment by (re)configuring an application and launching the benchmark, or run a script that collects the results.

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]

Check if the environment is ready and set up the application and benchmarks on a remote host.

Parameters:
  • tunables (TunableGroups) – A collection of tunable OS and application parameters along with their values. Setting these parameters should not require an OS reboot.

  • 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

teardown() None[source]

Clean up and shut down the remote environment.

Return type:

None