mlos_bench.services.remote.azure.azure_vm_services
A collection Service functions for managing VMs on Azure.
Classes
Helper methods to manage VMs on Azure. |
Module Contents
- class mlos_bench.services.remote.azure.azure_vm_services.AzureVMService(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.remote.azure.azure_deployment_services.AzureDeploymentService
,mlos_bench.services.types.host_provisioner_type.SupportsHostProvisioning
,mlos_bench.services.types.host_ops_type.SupportsHostOps
,mlos_bench.services.types.os_ops_type.SupportsOSOps
,mlos_bench.services.types.remote_exec_type.SupportsRemoteExec
Helper methods to manage VMs on Azure.
Create a new instance of Azure VM services proxy.
- Parameters:
config (dict) – Free-format dictionary that contains the benchmark environment configuration.
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.
- deallocate_host(params: dict) Tuple[mlos_bench.environments.status.Status, dict] [source]
Deallocates the VM on Azure by shutting it down then releasing the compute resources.
Note: This can cause the VM to arrive on a new host node when its restarted, which may have different performance characteristics.
- deprovision_host(params: dict) Tuple[mlos_bench.environments.status.Status, dict] [source]
Deprovisions the VM on Azure by deleting it.
- get_remote_exec_results(config: dict) Tuple[mlos_bench.environments.status.Status, dict] [source]
Get the results of the asynchronously running command.
- Parameters:
config (dict) – Flat dictionary of (key, value) pairs of tunable parameters. Must have the “asyncResultsUrl” key to get the results. If the key is not present, return Status.PENDING.
- Returns:
result – A pair of Status and result. Status is one of {PENDING, SUCCEEDED, FAILED, TIMED_OUT} A dict can have an “stdout” key with the remote output and an “stderr” key for errors / warnings.
- Return type:
- provision_host(params: dict) Tuple[mlos_bench.environments.status.Status, dict] [source]
Check if Azure VM is ready. Deploy a new VM, if necessary.
- Parameters:
params (dict) – Flat dictionary of (key, value) pairs of tunable parameters. HostEnv tunables are variable parameters that, together with the HostEnv configuration, are sufficient to provision a VM.
- Returns:
result – A pair of Status and result. The result is the input params plus the parameters extracted from the response JSON, or {} if the status is FAILED. Status is one of {PENDING, SUCCEEDED, FAILED}
- Return type:
- reboot(params: dict, force: bool = False) Tuple[mlos_bench.environments.status.Status, dict] [source]
Initiates a (graceful) shutdown of the Host/VM OS.
- remote_exec(script: Iterable[str], config: dict, env_params: dict) Tuple[mlos_bench.environments.status.Status, dict] [source]
Run a command on Azure VM.
- Parameters:
script (Iterable[str]) – A list of lines to execute as a script on a remote VM.
config (dict) – Flat dictionary of (key, value) pairs of the Environment parameters. They usually come from const_args and tunable_params properties of the Environment.
env_params (dict) – Parameters to pass as shell environment variables into the script. This is usually a subset of config with some possible conversions.
- Returns:
result – A pair of Status and result. Status is one of {PENDING, SUCCEEDED, FAILED}
- Return type:
- restart_host(params: dict, force: bool = False) Tuple[mlos_bench.environments.status.Status, dict] [source]
Reboot the VM on Azure by initiating a graceful shutdown.
- shutdown(params: dict, force: bool = False) Tuple[mlos_bench.environments.status.Status, dict] [source]
Initiates a (graceful) shutdown of the Host/VM OS.
- start_host(params: dict) Tuple[mlos_bench.environments.status.Status, dict] [source]
Start the VM on Azure.
- stop_host(params: dict, force: bool = False) Tuple[mlos_bench.environments.status.Status, dict] [source]
Stops the VM on Azure by initiating a graceful shutdown.
- wait_host_deployment(params: dict, *, is_setup: bool) Tuple[mlos_bench.environments.status.Status, dict] [source]
Waits for a pending operation on an Azure VM to resolve to SUCCEEDED or FAILED. Return TIMED_OUT when timing out.
- Parameters:
- Returns:
result – A pair of Status and result. Status is one of {PENDING, SUCCEEDED, FAILED, TIMED_OUT} Result is info on the operation runtime if SUCCEEDED, otherwise {}.
- Return type:
- wait_host_operation(params: dict) Tuple[mlos_bench.environments.status.Status, dict] [source]
Waits for a pending operation on an Azure VM to resolve to SUCCEEDED or FAILED. Return TIMED_OUT when timing out.
- Parameters:
params (dict) – Flat dictionary of (key, value) pairs of tunable parameters. Must have the “asyncResultsUrl” key to get the results. If the key is not present, return Status.PENDING.
- Returns:
result – A pair of Status and result. Status is one of {PENDING, SUCCEEDED, FAILED, TIMED_OUT} Result is info on the operation runtime if SUCCEEDED, otherwise {}.
- Return type:
- wait_os_operation(params: dict) Tuple[mlos_bench.environments.status.Status, dict] [source]
Waits for a pending operation on an OS to resolve to SUCCEEDED or FAILED. Return TIMED_OUT when timing out.
- Parameters:
params (dict) – Flat dictionary of (key, value) pairs of tunable parameters. Must have the “asyncResultsUrl” key to get the results. If the key is not present, return Status.PENDING.
- Returns:
result – A pair of Status and result. Status is one of {PENDING, SUCCEEDED, FAILED, TIMED_OUT} Result is info on the operation runtime if SUCCEEDED, otherwise {}.
- Return type:
- wait_remote_exec_operation(params: dict) Tuple[mlos_bench.environments.status.Status, dict] [source]
Waits for a pending remote execution on an Azure VM to resolve to SUCCEEDED or FAILED. Return TIMED_OUT when timing out.
- Parameters:
params (dict) – Flat dictionary of (key, value) pairs of tunable parameters. Must have the “asyncResultsUrl” key to get the results. If the key is not present, return Status.PENDING.
- Returns:
result – A pair of Status and result. Status is one of {PENDING, SUCCEEDED, FAILED, TIMED_OUT} Result is info on the operation runtime if SUCCEEDED, otherwise {}.
- Return type: