mlos_bench.services.types.vm_provisioner_type module

Protocol interface for VM provisioning operations.

class mlos_bench.services.types.vm_provisioner_type.SupportsVMOps(*args, **kwargs)

Bases: Protocol

Protocol interface for VM provisioning operations.

Methods

vm_deprovision(params)

Deallocates the VM by shutting it down then releasing the compute resources.

vm_provision(params)

Check if VM is ready.

vm_restart(params)

Restarts the VM by initiating a graceful shutdown.

vm_start(params)

Start a VM.

vm_stop(params)

Stops the VM by initiating a graceful shutdown.

wait_vm_deployment(is_setup, params)

Waits for a pending operation on an Azure VM to resolve to SUCCEEDED or FAILED.

wait_vm_operation(params)

Waits for a pending operation on a VM to resolve to SUCCEEDED or FAILED.

vm_deprovision(params: dict) Tuple[Status, dict]

Deallocates the VM by shutting it down then releasing the compute resources.

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}

vm_provision(params: dict) Tuple[Status, dict]

Check if VM is ready. Deploy a new VM, if necessary.

Parameters:
paramsdict

Flat dictionary of (key, value) pairs of tunable parameters. VMEnv tunables are variable parameters that, together with the VMEnv configuration, are sufficient to provision a VM.

Returns:
result(Status, dict={})

A pair of Status and result. The result is always {}. Status is one of {PENDING, SUCCEEDED, FAILED}

vm_restart(params: dict) Tuple[Status, dict]

Restarts the VM by initiating a graceful shutdown.

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}

vm_start(params: dict) Tuple[Status, dict]

Start a VM.

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}

vm_stop(params: dict) Tuple[Status, dict]

Stops the VM by initiating a graceful shutdown.

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}

wait_vm_deployment(is_setup: bool, 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:
is_setupbool

If True, wait for VM being deployed; otherwise, wait for successful deprovisioning.

paramsdict

Flat dictionary of (key, value) pairs of tunable parameters.

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_vm_operation(params: dict) Tuple[Status, dict]

Waits for a pending operation on a 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 {}.