AksCompute 類別
在 Azure Machine Learning 中管理 Azure Kubernetes Service 計算目標。
Azure Kubernetes Service (AKSCompute) 目標通常用於大規模生產部署,因為它們提供快速回應時間和自動調整已部署服務。 如需詳細資訊,請參閱 什麼是 Azure Machine Learning 中的計算目標?
類別 ComputeTarget 建構函式。
擷取與所提供工作區相關聯之 Compute 對象的雲端表示法。 傳回對應至所擷取之 Compute 物件之特定型別之子類別的實例。
- 繼承
-
AksCompute
建構函式
AksCompute(workspace, name)
參數
備註
下列範例示範如何使用已啟用 FPGA 的電腦建立 AKS 叢集。
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)
方法
attach |
已淘汰。 請改用 將現有的 AKS 計算資源與提供的工作區產生關聯。 |
attach_configuration |
建立用於附加 AKS 計算目標的組態物件。 |
delete |
從其相關聯的工作區中移除 AksCompute 物件。 如果此對像是透過 Azure Machine Learning 建立的,也會刪除對應的雲端式物件。 如果此物件是在外部建立,而且只附加至工作區,則這個方法會 ComputeTargetException 引發 ,而且不會變更任何內容。 |
deserialize |
將 JSON 物件轉換成 AksCompute 物件。 |
detach |
將 AksCompute 物件與其相關聯的工作區中斷連結。 基礎雲端物件不會刪除,只會移除關聯。 |
get_credentials |
擷取 AKS 目標的認證。 |
provisioning_configuration |
建立組態物件以布建 AKS 計算目標。 |
refresh_state |
執行物件的屬性就地更新。 這個方法會根據對應雲端物件的目前狀態來更新屬性。 這主要用於手動輪詢計算狀態。 |
serialize |
將此 AksCompute 物件轉換成 json 串行化字典。 |
update |
使用提供的更新組態來更新 AksCompute 物件。 |
attach
已淘汰。 請改用 attach_configuration
方法。
將現有的 AKS 計算資源與提供的工作區產生關聯。
static attach(workspace, name, resource_id)
參數
傳回
計算物件的 AksCompute 物件表示。
傳回類型
例外狀況
attach_configuration
建立用於附加 AKS 計算目標的組態物件。
static attach_configuration(resource_group=None, cluster_name=None, resource_id=None, cluster_purpose=None, load_balancer_type=None, load_balancer_subnet=None)
參數
- cluster_purpose
- str
叢集的目標使用方式。 這會用來布建 Azure Machine Learning 元件,以確保所需的容錯和 QoS 層級。 類別 ClusterPurpose 會定義可能的值。 如需詳細資訊,請參閱 附加現有的 AKS 叢集。
- load_balancer_subnet
- str
AKS 負載平衡器子網。 只有在使用 InternalLoadBalancer 做為負載平衡器類型時,才能使用它。 默認值為 aks-subnet。
傳回
附加 Compute 物件時要使用的組態物件。
傳回類型
例外狀況
delete
從其相關聯的工作區中移除 AksCompute 物件。
如果此對像是透過 Azure Machine Learning 建立的,也會刪除對應的雲端式物件。 如果此物件是在外部建立,而且只附加至工作區,則這個方法會 ComputeTargetException 引發 ,而且不會變更任何內容。
delete()
例外狀況
deserialize
將 JSON 物件轉換成 AksCompute 物件。
static deserialize(workspace, object_dict)
參數
傳回
所提供 JSON 物件的 AksCompute 表示法。
傳回類型
例外狀況
備註
ComputeTargetException如果提供的工作區不是計算相關聯的工作區,則引發 。
detach
get_credentials
provisioning_configuration
建立組態物件以布建 AKS 計算目標。
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)
參數
- vm_size
- str
代理程式 VM 的大小。 您可以在這裡找到完整的選項清單: https://aka.ms/azureml-aks-details。 默認為 Standard_D3_v2。
- location
- str
要布建叢集的位置。 如果未指定,則會預設為工作區位置。 您可以在這裡找到此計算的可用區域: https://azure.microsoft.com/global-infrastructure/services/?regions=all&products=kubernetes-service
- cluster_purpose
- str
叢集的目標使用方式。 這會用來布建 Azure Machine Learning 元件,以確保所需的容錯和 QoS 層級。 提供 AksCompute.ClusterPurpose 類別,方便指定可用的值。 如需這些值及其使用案例的詳細資訊,請參閱這裡: https://aka.ms/azureml-create-attach-aks
- load_balancer_type
- str
AKS 叢集的負載平衡器類型。 有效值為 PublicIp 和 InternalLoadBalancer。 預設值為 PublicIp。
- load_balancer_subnet
- str
AKS 叢集的負載平衡器子網。 只有在內部 Load Balancer 做為負載平衡器類型時,才能使用它。 默認值為 aks-subnet。
傳回
建立 Compute 物件時要使用的組態物件
傳回類型
例外狀況
refresh_state
serialize
將此 AksCompute 物件轉換成 json 串行化字典。
serialize()
傳回
這個 AksCompute 物件的 JSON 表示。
傳回類型
例外狀況
update
使用提供的更新組態來更新 AksCompute 物件。
update(update_configuration)
參數
例外狀況
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應