AksCompute class

Definition

Manages an Azure Kubernetes Service compute target in Azure Machine Learning.

Azure Kubernetes Service (AKSCompute) targets are typically used for high-scale production deployments because they provides fast response time and autoscaling of the deployed service. For more information, see What are compute targets in Azure Machine Learning?

AksCompute(workspace, name)
Inheritance
AksCompute

Parameters

workspace
Workspace

The workspace object containing the AksCompute object to retrieve.

name
str

The name of the of the AksCompute object to retrieve.

Remarks

The following sample shows how to create an AKS cluster with FPGA-enabled machines.


   from azureml.core.compute import AksCompute, ComputeTarget

   # Uses the specific FPGA enabled VM (sku: Standard_PB6s)
   # Standard_PB6s are available in: eastus, westus2, westeurope, southeastasia
   prov_config = AksCompute.provisioning_configuration(vm_size = "Standard_PB6s",
                                                       agent_count = 1,
                                                       location = "eastus")

   aks_name = 'my-aks-pb6'
   # Create the cluster
   aks_target = ComputeTarget.create(workspace = ws,
                                     name = aks_name,
                                     provisioning_configuration = prov_config)

Full sample is available from https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/deployment/accelerated-models/accelerated-models-quickstart.ipynb

Methods

attach(workspace, name, resource_id)

DEPRECATED. Use the attach_configuration method instead.

Associate an existing AKS compute resource with the provided workspace.

attach_configuration(resource_group=None, cluster_name=None, resource_id=None, cluster_purpose=None)

Create a configuration object for attaching a AKS compute target.

delete()

Remove the AksCompute object from its associated workspace.

If this object was created through Azure Machine Learning, the corresponding cloud-based objects will also be deleted. If this object was created externally and only attached to the workspace, this method raises a ComputeTargetException and nothing is changed.

deserialize(workspace, object_dict)

Convert a JSON object into an AksCompute object.

detach()

Detach the AksCompute object from its associated workspace.

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

get_credentials()

Retrieve the credentials for the AKS target.

provisioning_configuration(agent_count=None, vm_size=None, ssl_cname=None, ssl_cert_pem_file=None, ssl_key_pem_file=None, location=None, vnet_resourcegroup_name=None, vnet_name=None, subnet_name=None, service_cidr=None, dns_service_ip=None, docker_bridge_cidr=None, cluster_purpose=None, load_balancer_type=None, load_balancer_subnet=None)

Create a configuration object for provisioning an AKS compute target.

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 AksCompute object into a json serialized dictionary.

update(update_configuration)

Update the AksCompute object using the update configuration provided.

attach(workspace, name, resource_id)

DEPRECATED. Use the attach_configuration method instead.

Associate an existing AKS compute resource with the provided workspace.

attach(workspace, name, resource_id)

Parameters

workspace
Workspace

The workspace object to associate the compute resource with.

name
str

The name to associate with the compute resource inside the provided workspace. Does not have to match the name of the compute resource to be attached.

resource_id
str

The Azure resource ID for the compute resource being attached.

Returns

An AksCompute object representation of the compute object.

Return type

Exceptions

attach_configuration(resource_group=None, cluster_name=None, resource_id=None, cluster_purpose=None)

Create a configuration object for attaching a AKS compute target.

attach_configuration(resource_group=None, cluster_name=None, resource_id=None, cluster_purpose=None)

Parameters

resource_group
str

The name of the resource group in which the AKS is located.

default value: None
cluster_name
str

The AKS cluster name.

default value: None
resource_id
str

The Azure resource ID for the compute resource being attached.

default value: None
cluster_purpose
str

The targeted usage of the cluster. This is used to provision Azure Machine Learning components to ensure the desired level of fault-tolerance and QoS. The ClusterPurpose class defines the possible values. For more information, see Attach an existing AKS cluster.

default value: None

Returns

A configuration object to be used when attaching a Compute object

Return type

azureml.core.compute.ask.AksAttachConfiguration

Exceptions

delete()

Remove the AksCompute object from its associated workspace.

If this object was created through Azure Machine Learning, the corresponding cloud-based objects will also be deleted. If this object was created externally and only attached to the workspace, this method raises a ComputeTargetException and nothing is changed.

delete()

Exceptions

deserialize(workspace, object_dict)

Convert a JSON object into an AksCompute object.

deserialize(workspace, object_dict)

Parameters

workspace
Workspace

The workspace object the AksCompute object is associated with.

object_dict
dict

A JSON object to convert to an AksCompute object.

Returns

The AksCompute representation of the provided JSON object.

Return type

Exceptions

Remarks

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

detach()

Detach the AksCompute object from its associated workspace.

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

detach()

Exceptions

get_credentials()

Retrieve the credentials for the AKS target.

get_credentials()

Returns

The credentials for the AKS target.

Return type

Exceptions

provisioning_configuration(agent_count=None, vm_size=None, ssl_cname=None, ssl_cert_pem_file=None, ssl_key_pem_file=None, location=None, vnet_resourcegroup_name=None, vnet_name=None, subnet_name=None, service_cidr=None, dns_service_ip=None, docker_bridge_cidr=None, cluster_purpose=None, load_balancer_type=None, load_balancer_subnet=None)

Create a configuration object for provisioning an AKS compute target.

provisioning_configuration(agent_count=None, vm_size=None, ssl_cname=None, ssl_cert_pem_file=None, ssl_key_pem_file=None, location=None, vnet_resourcegroup_name=None, vnet_name=None, subnet_name=None, service_cidr=None, dns_service_ip=None, docker_bridge_cidr=None, cluster_purpose=None, load_balancer_type=None, load_balancer_subnet=None)

Parameters

agent_count
int

The number of agents (VMs) to host containers. Defaults to 3.

default value: None
vm_size
str

The size of agent VMs. A full list of options can be found here: https://aka.ms/azureml-aks-details. Defaults to Standard_D3_v2.

default value: None
ssl_cname
str

A CName to use if enabling SSL validation on the cluster. Must provide all three CName, cert file, and key file to enable SSL validation.

default value: None
ssl_cert_pem_file
str

A file path to a file containing cert information for SSL validation. Must provide all three CName, cert file, and key file to enable SSL validation.

default value: None
ssl_key_pem_file
str

A file path to a file containing key information for SSL validation. Must provide all three CName, cert file, and key file to enable SSL validation.

default value: None
location
str

The location to provision cluster in. If not specified, will default to workspace location. Available regions for this compute can be found here: https://azure.microsoft.com/global-infrastructure/services/?regions=all&products=kubernetes-service

default value: None
vnet_resourcegroup_name
str

The name of the resource group where the virtual network is located.

default value: None
vnet_name
str

The name of the virtual network.

default value: None
subnet_name
str

The name of the subnet inside the vnet.

default value: None
service_cidr
str

A CIDR notation IP range from which to assign service cluster IPs.

default value: None
dns_service_ip
str

Containers DNS server IP address.

default value: None
docker_bridge_cidr
str

A CIDR notation IP for Docker bridge.

default value: None
cluster_purpose
str

Targeted usage of the cluster. This is used to provision Azure Machine Learning components to ensure the desired level of fault-tolerance and QoS. AksCompute.ClusterPurpose class is provided for convenience of specifying available values. More detailed information of these values and their use cases can be found here: https://aka.ms/azureml-create-attach-aks

default value: None
load_balancer_type
str

Load balancer type of AKS cluster. Valid values are PublicIp and InternalLoadBalancer. Default value is PublicIp.

default value: None
load_balancer_subnet
str

Load balancer subnet of AKS cluster. It can be used only when Internal Load Balancer is used as load balancer type. Default value is aks-subnet.

default value: None

Returns

A configuration object to be used when creating a Compute object

Return type

Exceptions

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()

Exceptions

serialize()

Convert this AksCompute object into a json serialized dictionary.

serialize()

Returns

The JSON representation of this AksCompute object.

Return type

Exceptions

update(update_configuration)

Update the AksCompute object using the update configuration provided.

update(update_configuration)

Parameters

update_configuration
AksUpdateConfiguration

An AKS update configuration object.

Exceptions