BatchCompute クラス
Azure Machine Learning の Batch コンピューティング ターゲットを管理します。
Azure Batch は、大規模な並列コンピューティングやハイパフォーマンス コンピューティング (HPC) のアプリケーションをクラウドで効率的に実行するために使用されます。 BatchCompute は、Azure Machine Learning Pipelines で、 AzureBatchStepを使用してマシンの Azure Batch プールにジョブを送信するために使用されます。 詳細については、「Azure Machine Learning のコンピューティング先とは」を参照してください。
Class ComputeTarget コンストラクター。
指定されたワークスペースに関連付けられている Compute オブジェクトのクラウド表現を取得します。 取得した Compute オブジェクトの特定の型に対応する子クラスのインスタンスを返します。
コンストラクター
BatchCompute(workspace, name)
パラメーター
名前 | 説明 |
---|---|
workspace
必須
|
取得する BatchCompute オブジェクトを含むワークスペース オブジェクト。 |
name
必須
|
取得する BatchCompute オブジェクトの名前。 |
workspace
必須
|
取得する Compute オブジェクトを含むワークスペース オブジェクト。 |
name
必須
|
取得する Compute オブジェクトの名前。 |
注釈
使用する前に、Azure Batch アカウントを作成します。 作成するには、 Azure portal で Batch アカウントを作成する方法に関するページを参照してください。
次の例は、 attach_configurationを使用して Azure Batch コンピューティング アカウントをワークスペースにアタッチする方法を示しています。
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 オブジェクトの削除はサポートされていません。 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)
パラメーター
名前 | 説明 |
---|---|
resource_group
|
Batch アカウントが配置されているリソース グループの名前。 規定値: None
|
account_name
|
Batch アカウント名。 規定値: None
|
resource_id
|
アタッチされているコンピューティング リソースの Azure リソース ID。 規定値: None
|
戻り値
型 | 説明 |
---|---|
Compute オブジェクトをアタッチするときに使用する構成オブジェクト。 |
delete
deserialize
JSON オブジェクトを BatchCompute オブジェクトに変換します。
static deserialize(workspace, object_dict)
パラメーター
名前 | 説明 |
---|---|
workspace
必須
|
BatchCompute オブジェクトが関連付けられているワークスペース オブジェクト。 |
object_dict
必須
|
BatchCompute オブジェクトに変換する JSON オブジェクト。 |
戻り値
型 | 説明 |
---|---|
指定された JSON オブジェクトの BatchCompute 表現。 |
例外
型 | 説明 |
---|---|
注釈
指定されたワークスペースがコンピューティングが関連付けられているワークスペースでない場合は、 ComputeTargetException を発生させます。
detach
関連付けられているワークスペースから Batch オブジェクトをデタッチします。
基になるクラウド オブジェクトは削除されず、関連付けのみが削除されます。
detach()
例外
型 | 説明 |
---|---|
refresh_state
オブジェクトのプロパティのインプレース更新を実行します。
このメソッドは、対応するクラウド オブジェクトの現在の状態に基づいてプロパティを更新します。 これは主に、コンピューティング状態の手動ポーリングに使用されます。
refresh_state()
serialize
この BatchCompute オブジェクトを JSON シリアル化ディクショナリに変換します。
serialize()
戻り値
型 | 説明 |
---|---|
この BatchCompute オブジェクトの JSON 表記。 |