mlos_bench.services.remote.azure.azure_network_services module

A collection Service functions for managing virtual networks on Azure.

class mlos_bench.services.remote.azure.azure_network_services.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 {}.