HDInsightCompute クラス
Azure Machine Learning の HDInsight クラスター コンピューティング ターゲットを管理します。
Azure HDInsight は、ビッグ データ分析のための一般的なプラットフォームです。 そのプラットフォームでは、モデルのトレーニングに使用できる Apache Spark が提供されます。 詳細については、「Azure Machine Learning のコンピューティング先とは」を参照してください。
Class ComputeTarget コンストラクター。
指定されたワークスペースに関連付けられている Compute オブジェクトのクラウド表現を取得します。 取得した Compute オブジェクトの特定の型に対応する子クラスのインスタンスを返します。
コンストラクター
HDInsightCompute(workspace, name)
パラメーター
名前 | 説明 |
---|---|
workspace
必須
|
取得する HDInsightCompute オブジェクトを含むワークスペース オブジェクト。 |
name
必須
|
取得する HDInsightCompute オブジェクトの名前。 |
workspace
必須
|
取得する Compute オブジェクトを含むワークスペース オブジェクト。 |
name
必須
|
取得する Compute オブジェクトの名前。 |
注釈
次のサンプルは、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)
完全なサンプルは次から入手できます https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/training/train-in-spark/train-in-spark.ipynb
メソッド
attach |
廃止。 代わりに 既存の HDI リソースを指定されたワークスペースに関連付けます。 |
attach_configuration |
HDInsight コンピューティング ターゲットをアタッチするための構成オブジェクトを作成します。 HDInsight クラスターのパブリック アドレスを使用した HDInsight クラスターのアタッチはサポートされなくなりました。 代わりに、HDInsight クラスターの resourceId を使用します。 HDInsight クラスターの resourceId は、"/subscriptions/<subscription_id>/resourceGroups/<resource_group>/ providers/Microsoft.HDInsight/clusters/<cluster_name>" という文字列形式を使用して構築できます。 resourceId を構築せずに、subscription_id、resource_group、cluster_nameを使用することもできます。 詳細については、以下を参照してください。 https://aka.ms/azureml-compute-hdi |
delete |
HDInsightCompute オブジェクトの削除はサポートされていません。 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='')
パラメーター
名前 | 説明 |
---|---|
workspace
必須
|
コンピューティング リソースを関連付けるワークスペース オブジェクト。 |
name
必須
|
指定されたワークスペース内のコンピューティング リソースに関連付ける名前。 アタッチするコンピューティング リソースの名前と一致する必要はありません。 |
username
必須
|
リソースにアクセスするために必要なユーザー名。 |
address
必須
|
アタッチするリソースのアドレス。 |
ssh_port
|
リソースの公開ポート。 既定値は 22 です。 規定値: 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>" という文字列形式を使用して構築できます。
resourceId を構築せずに、subscription_id、resource_group、cluster_nameを使用することもできます。 詳細については、以下を参照してください。 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='')
パラメーター
名前 | 説明 |
---|---|
username
必須
|
リソースにアクセスするために必要なユーザー名。 |
subscription_id
|
Azure サブスクリプション ID 規定値: None
|
resource_group
|
HDI クラスターが配置されているリソース グループの名前。 規定値: None
|
cluster_name
|
HDI クラスター名 規定値: None
|
resource_id
|
アタッチするリソースの Azure Resource Manager (ARM) リソース ID。 規定値: None
|
address
|
アタッチするリソースのアドレス。 規定値: None
|
ssh_port
|
リソースの公開ポート。 既定値は 22 です。 規定値: 22
|
password
必須
|
リソースにアクセスするために必要なパスワード。 |
private_key_file
必須
|
リソースの秘密キーを含むファイルへのパス。 |
private_key_passphrase
必須
|
リソースにアクセスするために必要な秘密キー フレーズ。 |
戻り値
型 | 説明 |
---|---|
Compute オブジェクトをアタッチするときに使用する構成オブジェクト。 |
delete
deserialize
JSON オブジェクトを HDInsightCompute オブジェクトに変換します。
static deserialize(workspace, object_dict)
パラメーター
名前 | 説明 |
---|---|
workspace
必須
|
HDInsightCompute オブジェクトが関連付けられているワークスペース オブジェクト。 |
object_dict
必須
|
HDInsightCompute オブジェクトに変換する JSON オブジェクト。 |
戻り値
型 | 説明 |
---|---|
指定された JSON オブジェクトの HDInsightCompute 表現。 |
例外
型 | 説明 |
---|---|
注釈
指定されたワークスペースがコンピューティングが関連付けられているワークスペースでない場合は、 ComputeTargetException を発生させます。
detach
関連付けられているワークスペースから HDInsightCompute オブジェクトをデタッチします。
基になるクラウド オブジェクトは削除されず、関連付けのみが削除されます。
detach()
例外
型 | 説明 |
---|---|
get_credentials
HDInsightCompute ターゲットの資格情報を取得します。
get_credentials()
戻り値
型 | 説明 |
---|---|
HDInsightCompute ターゲットの資格情報 |
例外
型 | 説明 |
---|---|
refresh_state
オブジェクトのプロパティのインプレース更新を実行します。
このメソッドは、対応するクラウド オブジェクトの現在の状態に基づいてプロパティを更新します。 これは主に、コンピューティング状態の手動ポーリングに使用されます。
refresh_state()
serialize
この HDInsightCompute オブジェクトを JSON シリアル化ディクショナリに変換します。
serialize()
戻り値
型 | 説明 |
---|---|
この HDICompute オブジェクトの JSON 表記。 |