使用预留
为确保虚拟机资源在 Colab Enterprise 运行时需要时可用,您可以使用 Compute Engine 预留。预留为获取 Compute Engine 可用区级资源的容量提供了较高的保障。
概览
如需将预留功能与 Colab Enterprise 搭配使用,您需要执行以下任务:
限制和要求
当 Colab Enterprise 运行时使用预留时,需要遵循 Compute Engine 预留的所有限制。请参阅预留的工作原理。
此外,将预留与 Colab Enterprise 搭配使用时,存在以下限制和要求:
承诺使用折扣不适用。
您的预订必须与您的 Colab Enterprise 笔记本和运行时位于同一项目中。
预留的机器类型必须与运行时模板的机器类型匹配。
准备工作
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Vertex AI, Dataform, and Compute Engine APIs.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Vertex AI, Dataform, and Compute Engine APIs.
所需的角色
如需确保您的用户账号拥有将预留用于 Colab Enterprise 所需的权限,请让您的管理员为您的用户账号授予项目的以下 IAM 角色:
-
Colab Enterprise User (
roles/aiplatform.colabEnterpriseUser
) -
Compute Admin (
roles/compute.admin
)
如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限。
您的管理员还可以通过自定义角色或其他预定义角色向您的用户账号授予所需的权限。
创建预留
创建 Compute Engine 预留。它可以是单项目预留,也可以是共享预留。如需了解详情,请参阅以下文档:
预留可以包含 GPU 加速器。
将您的预订添加到新的运行时模板
如需创建使用您的预留的运行时模板,请执行以下操作:-
在 Google Cloud 控制台中,进入 Colab Enterprise 运行时模板页面。
-
点击
新建模板。此时会显示创建新的运行时模板对话框。
-
在运行时基本信息部分中,输入显示名称。
-
在区域菜单中,选择需要运行时模板的区域。
-
在配置计算部分的机器类型菜单中,选择机器类型。运行时模板的机器类型必须与预留的机器类型匹配。
-
在预留菜单中,选择要使用的具体预留,或选择使用自动选择的预留。
如需详细了解如何使用自动选择的预留或明确指定的预留,请参阅预留的工作原理的使用类型部分。
-
完成对话框的其余部分,然后点击创建。
您的运行时模板会显示在运行时模板标签页上的列表中。
使用预留
如需使用预订,请执行以下操作:
停止使用预留
如需停止使用预留,您可以删除预留。
如果您希望继续将您的预留用于其他资源,但不希望 Colab Enterprise 笔记本使用它,请删除与您的预留相关联的运行时和运行时模板。
结算
预留的 Compute Engine 虚拟机资源在 Colab Enterprise 运行时由 Colab Enterprise 计费,并在虚拟机资源未被 Colab Enterprise 使用时由 Compute Engine 计费。
问题排查
本部分介绍了如何解决在将预订功能与 Colab Enterprise 搭配使用时遇到的问题。
无法创建运行时
尝试创建运行时时,会出现如下所示的错误。
Failed to create notebook runtime with error: Invalid value for field 'resource.reservationAffinity': '{"consumeReservationType": "SPECIFIC_ALLOCATION", "key": "compute.googleapis.com/reservation-name...'. No available resources in specified reservations.
如果运行时模板和预留的机器类型不匹配,就会出现此错误。
如需解决此问题,请创建一个机器类型与预留的机器类型匹配的运行时模板。
后续步骤
如需向主账号授予对运行时模板的访问权限,请参阅管理对运行时模板的访问权限。
如需详细了解 Compute Engine 预留,请参阅 Compute Engine 可用区级资源的预留。