BatchCompute 类
在 Azure 机器学习中管理 Batch 计算目标。
Azure Batch 用于在云中高效运行大规模并行高性能计算 (HPC) 应用程序。 可以在 Azure 机器学习管道中使用 BatchCompute,以使用 AzureBatchStep 将作业提交到 Azure Batch 计算机池。 有关详细信息,请参阅什么是 Azure 机器学习中的计算目标?
类 ComputeTarget 构造函数。
检索与提供的工作区关联的 Compute 对象的云表示形式。 返回与检索的 Compute 对象的特定类型对应的子类的实例。
- 继承
-
BatchCompute
构造函数
BatchCompute(workspace, name)
参数
注解
在使用之前创建 Azure Batch 帐户。 要创建 Batch 帐户,请参阅使用 Azure 门户创建 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)
参数
返回
要在附加计算对象时使用的配置对象。
返回类型
delete
deserialize
将 JSON 对象转换为 BatchCompute 对象。
static deserialize(workspace, object_dict)
参数
返回
所提供的 JSON 对象的 BatchCompute 表示形式。
返回类型
例外
注解
如果提供的工作区不是与计算关联的工作区,则引发 ComputeTargetException。
detach
refresh_state
执行对象属性的就地更新。
此方法根据相应云对象的当前状态更新属性。 这主要手动轮询计算状态。
refresh_state()
serialize
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈