mlos_bench.services.remote.azure package¶
Azure-specific benchmark environments for mlos_bench.
- class mlos_bench.services.remote.azure.AzureAuthService(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)¶
Bases:
Service
,SupportsAuth
[TokenCredential
]Helper methods to get access to Azure services.
- Attributes:
config_loader_service
Return a config loader service.
Methods
export
()Return a dictionary of functions available in this service.
Get the access token from Azure CLI, if expired.
Get the authorization part of HTTP headers for REST API calls.
Return the Azure SDK credential object.
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.
- get_access_token() str ¶
Get the access token from Azure CLI, if expired.
- get_auth_headers() dict ¶
Get the authorization part of HTTP headers for REST API calls.
- get_credential() TokenCredential ¶
Return the Azure SDK credential object.
Bases:
FileShareService
Helper methods for interacting with Azure File Share.
- 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.
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.
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.
- class mlos_bench.services.remote.azure.AzureNetworkService(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)¶
Bases:
AzureDeploymentService
,SupportsNetworkProvisioning
Helper methods to manage Virtual Networks on Azure.
- Attributes:
config_loader_service
Return a config loader service.
deploy_params
Get the deployment parameters.
Methods
deprovision_network
(params[, ignore_errors])Deprovisions the virtual network on Azure by deleting it.
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.
provision_network
(params)Deploy a virtual network, if necessary.
register
(services)Register new mix-in services.
wait_network_deployment
(params, *, is_setup)Waits for a pending operation on an Azure VM to resolve to SUCCEEDED or FAILED.
- deprovision_network(params: dict, ignore_errors: bool = True) Tuple[Status, dict] ¶
Deprovisions the virtual network on Azure by deleting it.
- Parameters:
- paramsdict
Flat dictionary of (key, value) pairs of tunable parameters.
- ignore_errorsboolean
Whether to ignore errors (default) encountered during the operation (e.g., due to dependent resources still in use).
- Returns:
- result(Status, dict={})
A pair of Status and result. The result is always {}. Status is one of {PENDING, SUCCEEDED, FAILED}
- provision_network(params: dict) Tuple[Status, dict] ¶
Deploy a virtual network, if necessary.
- Parameters:
- paramsdict
Flat dictionary of (key, value) pairs of tunable parameters. NetworkEnv tunables are variable parameters that, together with the NetworkEnv configuration, are sufficient to provision a virtual network.
- Returns:
- result(Status, dict={})
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}
- wait_network_deployment(params: dict, *, is_setup: bool) Tuple[Status, dict] ¶
Waits for a pending operation on an Azure VM to resolve to SUCCEEDED or FAILED. Return TIMED_OUT when timing out.
- Parameters:
- paramsdict
Flat dictionary of (key, value) pairs of tunable parameters.
- is_setupbool
If True, wait for VM being deployed; otherwise, wait for successful deprovisioning.
- Returns:
- result(Status, dict)
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 {}.
- class mlos_bench.services.remote.azure.AzureSaaSConfigService(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)¶
Bases:
Service
,SupportsRemoteConfig
Helper methods to configure Azure Flex services.
- Attributes:
config_loader_service
Return a config loader service.
Methods
configure
(config, params)Update the parameters of an Azure DB service.
export
()Return a dictionary of functions available in this service.
is_config_pending
(config)Check if the configuration of an Azure DB service requires a reboot or restart.
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.
- configure(config: Dict[str, Any], params: Dict[str, Any]) Tuple[Status, dict] ¶
Update the parameters of an Azure DB service.
- Parameters:
- configDict[str, Any]
Key/value pairs of configuration parameters (e.g., vmName).
- paramsDict[str, Any]
Key/value pairs of the service parameters to update.
- Returns:
- result(Status, dict={})
A pair of Status and result. The result is always {}. Status is one of {PENDING, SUCCEEDED, FAILED}
- is_config_pending(config: Dict[str, Any]) Tuple[Status, dict] ¶
Check if the configuration of an Azure DB service requires a reboot or restart.
- Parameters:
- configDict[str, Any]
Key/value pairs of configuration parameters (e.g., vmName).
- Returns:
- result(Status, dict)
A pair of Status and result. A Boolean field “isConfigPendingRestart” indicates whether the service restart is required. If “isConfigPendingReboot” is set to True, rebooting a VM is necessary. Status is one of {PENDING, TIMED_OUT, SUCCEEDED, FAILED}
- class mlos_bench.services.remote.azure.AzureVMService(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)¶
Bases:
AzureDeploymentService
,SupportsHostProvisioning
,SupportsHostOps
,SupportsOSOps
,SupportsRemoteExec
Helper methods to manage VMs on Azure.
- Attributes:
config_loader_service
Return a config loader service.
deploy_params
Get the deployment parameters.
Methods
deallocate_host
(params)Deallocates the VM on Azure by shutting it down then releasing the compute resources.
deprovision_host
(params)Deprovisions the VM on Azure by deleting it.
export
()Return a dictionary of functions available in this service.
get_remote_exec_results
(config)Get the results of the asynchronously running command.
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.
provision_host
(params)Check if Azure VM is ready.
reboot
(params[, force])Initiates a (graceful) shutdown of the Host/VM OS.
register
(services)Register new mix-in services.
remote_exec
(script, config, env_params)Run a command on Azure VM.
restart_host
(params[, force])Reboot the VM on Azure by initiating a graceful shutdown.
shutdown
(params[, force])Initiates a (graceful) shutdown of the Host/VM OS.
start_host
(params)Start the VM on Azure.
stop_host
(params[, force])Stops the VM on Azure by initiating a graceful shutdown.
wait_host_deployment
(params, *, is_setup)Waits for a pending operation on an Azure VM to resolve to SUCCEEDED or FAILED.
wait_host_operation
(params)Waits for a pending operation on an Azure VM to resolve to SUCCEEDED or FAILED.
wait_os_operation
(params)Waits for a pending operation on an OS to resolve to SUCCEEDED or FAILED.
- deallocate_host(params: dict) Tuple[Status, dict] ¶
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.
- Parameters:
- paramsdict
Flat dictionary of (key, value) pairs of tunable parameters.
- Returns:
- result(Status, dict={})
A pair of Status and result. The result is always {}. Status is one of {PENDING, SUCCEEDED, FAILED}
- deprovision_host(params: dict) Tuple[Status, dict] ¶
Deprovisions the VM on Azure by deleting it.
- Parameters:
- paramsdict
Flat dictionary of (key, value) pairs of tunable parameters.
- Returns:
- result(Status, dict={})
A pair of Status and result. The result is always {}. Status is one of {PENDING, SUCCEEDED, FAILED}
- get_remote_exec_results(config: dict) Tuple[Status, dict] ¶
Get the results of the asynchronously running command.
- Parameters:
- configdict
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(Status, dict)
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.
- provision_host(params: dict) Tuple[Status, dict] ¶
Check if Azure VM is ready. Deploy a new VM, if necessary.
- Parameters:
- paramsdict
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(Status, dict={})
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}
- reboot(params: dict, force: bool = False) Tuple[Status, dict] ¶
Initiates a (graceful) shutdown of the Host/VM OS.
- Parameters:
- params: dict
Flat dictionary of (key, value) pairs of tunable parameters.
- forcebool
If True, force restart the Host/VM.
- Returns:
- result(Status, dict={})
A pair of Status and result. The result is always {}. Status is one of {PENDING, SUCCEEDED, FAILED}
- remote_exec(script: Iterable[str], config: dict, env_params: dict) Tuple[Status, dict] ¶
Run a command on Azure VM.
- Parameters:
- scriptIterable[str]
A list of lines to execute as a script on a remote VM.
- configdict
Flat dictionary of (key, value) pairs of the Environment parameters. They usually come from const_args and tunable_params properties of the Environment.
- env_paramsdict
Parameters to pass as shell environment variables into the script. This is usually a subset of config with some possible conversions.
- Returns:
- result(Status, dict)
A pair of Status and result. Status is one of {PENDING, SUCCEEDED, FAILED}
- restart_host(params: dict, force: bool = False) Tuple[Status, dict] ¶
Reboot the VM on Azure by initiating a graceful shutdown.
- Parameters:
- paramsdict
Flat dictionary of (key, value) pairs of tunable parameters.
- forcebool
If True, force restart the Host/VM.
- Returns:
- result(Status, dict={})
A pair of Status and result. The result is always {}. Status is one of {PENDING, SUCCEEDED, FAILED}
- shutdown(params: dict, force: bool = False) Tuple[Status, dict] ¶
Initiates a (graceful) shutdown of the Host/VM OS.
- Parameters:
- params: dict
Flat dictionary of (key, value) pairs of tunable parameters.
- forcebool
If True, force stop the Host/VM.
- Returns:
- result(Status, dict={})
A pair of Status and result. The result is always {}. Status is one of {PENDING, SUCCEEDED, FAILED}
- start_host(params: dict) Tuple[Status, dict] ¶
Start the VM on Azure.
- Parameters:
- paramsdict
Flat dictionary of (key, value) pairs of tunable parameters.
- Returns:
- result(Status, dict={})
A pair of Status and result. The result is always {}. Status is one of {PENDING, SUCCEEDED, FAILED}
- stop_host(params: dict, force: bool = False) Tuple[Status, dict] ¶
Stops the VM on Azure by initiating a graceful shutdown.
- Parameters:
- paramsdict
Flat dictionary of (key, value) pairs of tunable parameters.
- forcebool
If True, force stop the Host/VM.
- Returns:
- result(Status, dict={})
A pair of Status and result. The result is always {}. Status is one of {PENDING, SUCCEEDED, FAILED}
- wait_host_deployment(params: dict, *, is_setup: bool) Tuple[Status, dict] ¶
Waits for a pending operation on an Azure VM to resolve to SUCCEEDED or FAILED. Return TIMED_OUT when timing out.
- Parameters:
- paramsdict
Flat dictionary of (key, value) pairs of tunable parameters.
- is_setupbool
If True, wait for VM being deployed; otherwise, wait for successful deprovisioning.
- Returns:
- result(Status, dict)
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 {}.
- wait_host_operation(params: dict) Tuple[Status, dict] ¶
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(Status, dict)
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 {}.
- wait_os_operation(params: dict) Tuple[Status, dict] ¶
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(Status, dict)
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 {}.
Submodules¶
- mlos_bench.services.remote.azure.azure_auth module
- mlos_bench.services.remote.azure.azure_deployment_services module
- mlos_bench.services.remote.azure.azure_fileshare module
- mlos_bench.services.remote.azure.azure_network_services module
- mlos_bench.services.remote.azure.azure_saas module
- mlos_bench.services.remote.azure.azure_vm_services module
AzureVMService
AzureVMService.deallocate_host()
AzureVMService.deprovision_host()
AzureVMService.get_remote_exec_results()
AzureVMService.provision_host()
AzureVMService.reboot()
AzureVMService.remote_exec()
AzureVMService.restart_host()
AzureVMService.shutdown()
AzureVMService.start_host()
AzureVMService.stop_host()
AzureVMService.wait_host_deployment()
AzureVMService.wait_host_operation()
AzureVMService.wait_os_operation()