HDInsightCompute 類別
在 Azure Machine Learning 中管理 HDInsight 叢集計算目標。
Azure HDInsight 是巨量資料分析的常用平台。 此平台會提供 Apache Spark,可用來將您的模型定型。 如需詳細資訊,請參閱 什麼是 Azure Machine Learning 中的計算目標?
類別 ComputeTarget 建構函式。
擷取與所提供工作區相關聯之 Compute 物件的雲端標記法。 傳回對應至所擷取之 Compute 物件之特定型別之子類別的實例。
- 繼承
-
HDInsightCompute
建構函式
HDInsightCompute(workspace, name)
參數
備註
下列範例示範如何在 Azure 中建立適用于 HDInsight 叢集的 Spark。
from azureml.core.compute import ComputeTarget, HDInsightCompute
from azureml.exceptions import ComputeTargetException
import os
try:
# If you want to connect using SSH key instead of username/password you can provide parameters private_key_file and private_key_passphrase
# Attaching a HDInsight cluster using the public address of the HDInsight cluster is no longer supported.
# Instead, use resourceId of the HDInsight cluster.
# The resourceId of the HDInsight Cluster can be constructed using the following string format:
# /subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.HDInsight/clusters/<cluster_name>.
# You can also use subscription_id, resource_group and cluster_name without constructing resourceId.
attach_config = HDInsightCompute.attach_configuration(resource_id='<resource_id>',
ssh_port=22,
username=os.environ.get('hdiusername', '<ssh_username>'),
password=os.environ.get('hdipassword', '<my_password>'))
hdi_compute = ComputeTarget.attach(workspace=ws,
name='myhdi',
attach_configuration=attach_config)
except ComputeTargetException as e:
print("Caught = {}".format(e.message))
hdi_compute.wait_for_completion(show_output=True)
方法
attach |
已淘汰。 請改用 將現有的 HDI 資源與提供的工作區產生關聯。 |
attach_configuration |
建立用來附加 HDInsight 計算目標的組態物件。 不再支援使用 HDInsight 叢集的公用位址連結 HDInsight 叢集。 請改用 HDInsight 叢集的 resourceId。 HDInsight 叢集的 resourceId 可以使用下列字串格式來建構:「/subscriptions/ < subscription_id/resourceGroups/ < resource_group >> / providers/Microsoft.HDInsight/clusters/ < cluster_name > 」。 您也可以使用 subscription_id、resource_group 和 cluster_name,而不需要建構 resourceId。 如需詳細資訊: https://aka.ms/azureml-compute-hdi |
delete |
HDInsightCompute 物件不支援 Delete。 請改用 detach。 |
deserialize |
將 JSON 物件轉換成 HDInsightCompute 物件。 |
detach |
中斷連結 HDInsightCompute 物件與其相關聯的工作區。 基礎雲端物件不會刪除,只會移除關聯。 |
get_credentials |
擷取 HDInsightCompute 目標的認證。 |
refresh_state |
執行 物件的屬性就地更新。 這個方法會根據對應雲端物件的目前狀態來更新屬性。 這主要用於手動輪詢計算狀態。 |
serialize |
將此 HDInsightCompute 物件轉換成 JSON 序列化字典。 |
attach
已淘汰。 請改用 attach_configuration
方法。
將現有的 HDI 資源與提供的工作區產生關聯。
static attach(workspace, name, username, address, ssh_port='22', password='', private_key_file='', private_key_passphrase='')
參數
傳回
計算物件的 HDInsightCompute 物件表示。
傳回類型
例外狀況
attach_configuration
建立用來附加 HDInsight 計算目標的組態物件。
不再支援使用 HDInsight 叢集的公用位址連結 HDInsight 叢集。 請改用 HDInsight 叢集的 resourceId。 HDInsight 叢集的 resourceId 可以使用下列字串格式來建構:「/subscriptions/ < subscription_id/resourceGroups/ < resource_group >> / providers/Microsoft.HDInsight/clusters/ < cluster_name > 」。
您也可以使用 subscription_id、resource_group 和 cluster_name,而不需要建構 resourceId。 如需詳細資訊: https://aka.ms/azureml-compute-hdi
static attach_configuration(username, subscription_id=None, resource_group=None, cluster_name=None, resource_id=None, address=None, ssh_port='22', password='', private_key_file='', private_key_passphrase='')
參數
傳回
附加 Compute 物件時要使用的組態物件。
傳回類型
例外狀況
delete
deserialize
將 JSON 物件轉換成 HDInsightCompute 物件。
static deserialize(workspace, object_dict)
參數
傳回
所提供 JSON 物件的 HDInsightCompute 標記法。
傳回類型
例外狀況
備註
ComputeTargetException如果提供的工作區不是計算相關聯的工作區,則引發 。
detach
get_credentials
擷取 HDInsightCompute 目標的認證。
get_credentials()
傳回
HDInsightCompute 目標的認證
傳回類型
例外狀況
refresh_state
serialize
將此 HDInsightCompute 物件轉換成 JSON 序列化字典。
serialize()
傳回
這個 HDICompute 物件的 JSON 表示。
傳回類型
例外狀況
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應