AksCompute Class
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?
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.
- Inheritance
-
AksCompute
Constructor
AksCompute(workspace, name)
Parameters
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)
Methods
attach |
DEPRECATED. Use the Associate an existing AKS compute resource with the provided workspace. |
attach_configuration |
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 |
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 |
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 the AksCompute object using the update configuration provided. |
attach
DEPRECATED. Use the attach_configuration
method instead.
Associate an existing AKS compute resource with the provided workspace.
static attach(workspace, name, resource_id)
Parameters
- 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.
Returns
An AksCompute object representation of the compute object.
Return type
Exceptions
attach_configuration
Create a configuration object for attaching a AKS compute target.
static attach_configuration(resource_group=None, cluster_name=None, resource_id=None, cluster_purpose=None, load_balancer_type=None, load_balancer_subnet=None)
Parameters
- 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.
- load_balancer_type
- str
The AKS cluster type. Valid values are PublicIp and InternalLoadBalancer. Default value is PublicIp.
- load_balancer_subnet
- str
The AKS load balancer subnet. It can be used only when InternalLoadBalancer is used as load balancer type. Default value is aks-subnet.
Returns
A configuration object to be used when attaching a Compute object.
Return type
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
Convert a JSON object into an AksCompute object.
static deserialize(workspace, object_dict)
Parameters
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
Create a configuration object for provisioning an AKS compute target.
static 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
- 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.
- 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.
- 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.
- 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.
- 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
- vnet_resourcegroup_name
- str
The name of the resource group where the virtual network is located.
- service_cidr
- str
A CIDR notation IP range from which to assign service cluster IPs.
- 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
- load_balancer_type
- str
Load balancer type of AKS cluster. Valid values are PublicIp and InternalLoadBalancer. Default value is PublicIp.
- 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.
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 the AksCompute object using the update configuration provided.
update(update_configuration)
Parameters
Exceptions
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for