BatchCompute 類別
管理 Azure Machine Learning 中的 Batch 計算目標。
Azure Batch 可用來在雲端有效率地執行大規模的平行和高效能運算 (HPC) 應用程式。 BatchCompute 用於 Azure Machine Learning 管線,以使用 AzureBatchStep 將作業提交至機器Azure Batch集區。 如需詳細資訊,請參閱 什麼是 Azure Machine Learning 中的計算目標?
類別 ComputeTarget 建構函式。
擷取與所提供工作區相關聯的 Compute 物件的雲端標記法。 傳回對應至所擷取之 Compute 物件之特定類型的子類別實例。
- 繼承
-
BatchCompute
建構函式
BatchCompute(workspace, name)
參數
備註
在使用帳戶之前,請先建立Azure Batch帳戶。 若要建立一個帳戶,請參閱使用 Azure 入口網站建立 Batch 帳戶。
下列範例示範如何使用 將Azure Batch計算帳戶附加至工作區 attach_configuration 。
batch_compute_name = 'mybatchcompute' # Name to associate with new compute in workspace
# Batch account details needed to attach as compute to workspace
batch_account_name = "<batch_account_name>" # Name of the Batch account
batch_resource_group = "<batch_resource_group>" # Name of the resource group which contains this account
try:
# check if already attached
batch_compute = BatchCompute(ws, batch_compute_name)
except ComputeTargetException:
print('Attaching Batch compute...')
provisioning_config = BatchCompute.attach_configuration(resource_group=batch_resource_group,
account_name=batch_account_name)
batch_compute = ComputeTarget.attach(ws, batch_compute_name, provisioning_config)
batch_compute.wait_for_completion()
print("Provisioning state:{}".format(batch_compute.provisioning_state))
print("Provisioning errors:{}".format(batch_compute.provisioning_errors))
print("Using Batch compute:{}".format(batch_compute.cluster_resource_id))
方法
attach_configuration |
建立用於附加 Batch 計算目標的組態物件。 |
delete |
BatchCompute 物件不支援 Delete。 請改用 detach。 |
deserialize |
將 JSON 物件轉換成 BatchCompute 物件。 |
detach |
從其相關聯的工作區中斷連結 Batch 物件。 基礎雲端物件不會刪除,只會移除關聯。 |
refresh_state |
執行物件的屬性就地更新。 此方法會根據對應雲端物件的目前狀態來更新屬性。 這主要用於手動輪詢計算狀態。 |
serialize |
將此 BatchCompute 物件轉換成 JSON 序列化字典。 |
attach_configuration
建立用於附加 Batch 計算目標的組態物件。
static attach_configuration(resource_group=None, account_name=None, resource_id=None)
參數
傳回
附加 Compute 物件時要使用的組態物件。
傳回類型
delete
deserialize
將 JSON 物件轉換成 BatchCompute 物件。
static deserialize(workspace, object_dict)
參數
傳回
所提供 JSON 物件的 BatchCompute 標記法。
傳回類型
例外狀況
備註
ComputeTargetException如果提供的工作區不是計算相關聯的工作區,則引發 。
detach
refresh_state
執行物件的屬性就地更新。
此方法會根據對應雲端物件的目前狀態來更新屬性。 這主要用於手動輪詢計算狀態。
refresh_state()
serialize
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應