Share via


KubernetesCompute Class

Note

This is an experimental class, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.

KubernetesCompute (Preview) is a customer managed K8s cluster attached to a workspace by cluster admin.

User granted access and quota to the compute can easily specify and submit a one-node or distributed multi-node ML workload to the compute. The compute executes in a containerized environment and packages your model dependencies in a docker container. For more information, see What are compute targets in Azure Machine Learning? /azure/machine-learning/concept-compute-target

Class ComputeTarget constructor.

Retrieve a cloud representation of a Compute object associated with the provided workspace. Returns an instance of a child class corresponding to the specific type of the retrieved Compute object.

Constructor

KubernetesCompute(workspace, name)

Parameters

Name Description
workspace
Required

The workspace object containing the KubernetesCompute object to retrieve.

name
Required
str

The name of the of the KubernetesCompute object to retrieve.

workspace
Required

The workspace object containing the Compute object to retrieve.

name
Required
str

The name of the of the Compute object to retrieve.

Remarks

In the following example, a persistent compute target provisioned by <xref:azureml.contrib.core.compute.KubernetesCompute.KubernetesCompute> is created. The provisioning_configuration parameter in this example is of type <xref:azureml.contrib.core.compute.KubernetesCompute.KubernetesComputeAttachConfiguration>, which is a child class of <xref:azureml.contrib.core.compute.KubernetesCompute.ComputeTargetAttachConfiguration>.

Methods

attach_configuration

Create a configuration object for attaching an compute target.

delete

Delete is not supported for an KubernetesCompute object. Use detach instead.

deserialize

Convert a JSON object into a KubernetesCompute object.

detach

Detach the KubernetesCompute object from its associated workspace.

Underlying cloud objects are not deleted, only the association is removed.

get

Send GET compute object request to mlc.

get_status

Retrieve the current detailed status for the KubernetesCompute cluster.

refresh_state

Perform an in-place update of the properties of the object.

This method updates the properties based on the current state of the corresponding cloud object. This is primarily used for manual polling of compute state.

serialize

Convert this KubernetesCompute object into a JSON serialized dictionary.

wait_for_completion

Wait for the KubernetesCompute cluster to finish provisioning.

attach_configuration

Create a configuration object for attaching an compute target.

static attach_configuration(resource_id=None, namespace=None, identity_type=None, identity_ids=None)

Parameters

Name Description
resource_id
str

The resource id.

Default value: None
namespace
str

The Kubernetes namespace to be used by workloads submitted to the compute target.

Default value: None
identity_type

identity type.

Default value: None
identity_ids

List of resource ids for the user assigned identity. eg. ['/subscriptions/<subid>/resourceGroups/<rg>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<id>']

Default value: None

Returns

Type Description
<xref:azureml.contrib.core.compute.KubernetesCompute.KubernetesComputeAttachConfiguration>

A configuration object to be used when attaching a KubernetesCompute object.

delete

Delete is not supported for an KubernetesCompute object. Use detach instead.

delete()

Exceptions

Type Description

deserialize

Convert a JSON object into a KubernetesCompute object.

static deserialize(workspace, object_dict)

Parameters

Name Description
workspace
Required

The workspace object the KubernetesCompute object is associated with.

object_dict
Required

A JSON object to convert to a KubernetesCompute object.

Returns

Type Description
<xref:azureml.contrib.core.compute.KubernetesCompute.KubernetesCompute>

The KubernetesCompute representation of the provided JSON object.

Exceptions

Type Description

Remarks

Raises a ComputeTargetException if the provided workspace is not the workspace the Compute is associated with.

detach

Detach the KubernetesCompute object from its associated workspace.

Underlying cloud objects are not deleted, only the association is removed.

detach()

Exceptions

Type Description

get

Send GET compute object request to mlc.

get()

get_status

Retrieve the current detailed status for the KubernetesCompute cluster.

get_status()

Returns

Type Description

A detailed status object for the cluster

refresh_state

Perform an in-place update of the properties of the object.

This method updates the properties based on the current state of the corresponding cloud object. This is primarily used for manual polling of compute state.

refresh_state()

serialize

Convert this KubernetesCompute object into a JSON serialized dictionary.

serialize()

Returns

Type Description

The JSON representation of this KubernetesCompute object.

wait_for_completion

Wait for the KubernetesCompute cluster to finish provisioning.

wait_for_completion(show_output=False, is_delete_operation=False)

Parameters

Name Description
show_output

Boolean to provide more verbose output.

Default value: False
is_delete_operation

Indicates whether the operation is meant for deleting.

Default value: False

Exceptions

Type Description