SageMaker HyperPod 集群管理 - 亚马逊 SageMaker AI
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

SageMaker HyperPod 集群管理

以下主题讨论了日志记录和管理 SageMaker HyperPod 集群。

记录 SageMaker HyperPod 事件

来自的所有事件和日志 SageMaker HyperPod 都以日志组名称保存到 Amazon CloudWatch /aws/sagemaker/Clusters/[ClusterName]/[ClusterID]。每次调用 CreateCluster API 都会创建一个新的日志组。以下列表包含每个日志组收集的所有可用日志流。

日志组名称 日志流名称
/aws/sagemaker/Clusters/[ClusterName]/[ClusterID] LifecycleConfig/[instance-group-name]/[instance-id]

SageMaker HyperPod 在实例级别进行日志记录

您可以访问在集群实例配置 CloudWatch 期间发布到的 LifecycleScript 日志。创建的集群中的每个实例都会生成单独的日志流,以 LifecycleConfig/[instance-group-name]/[instance-id] 格式区分。

写入的所有日志都将/var/log/provision/provisioning.log上传到前面的 CloudWatch 流中。 LifecycleScripts 在1.architectures/5.sagemaker_hyperpods/LifecycleScripts/base-config将他们stdout和重定向stderr到此位置时示例。如果您使用的是自定义脚本,请将日志写入可用的/var/log/provision/provisioning.log位置 CloudWatch。

生命周期脚本日志标记

CloudWatch 生命周期脚本的日志包含特定的标记,可帮助您跟踪执行进度并识别问题:

Marker 描述
START Indicates the beginning of lifecycle script logs for the instance
[SageMaker] Lifecycle scripts were provided, with S3 uri: [s3://bucket-name/] and entrypoint script: [script-name.sh] Indicates the S3 location and entrypoint script that will be used
[SageMaker] Downloading lifecycle scripts Indicates scripts are being downloaded from the specified S3 location
[SageMaker] Lifecycle scripts have been downloaded Indicates scripts have been successfully downloaded from S3
[SageMaker] The lifecycle scripts succeeded Indicates successful completion of all lifecycle scripts
[SageMaker] The lifecycle scripts failed Indicates failed execution of lifecycle scripts

这些标记可帮助您快速确定问题在生命周期脚本执行过程中的哪个位置出现。排除故障时,请查看日志条目以确定进程在何处停止或失败。

生命周期脚本失败消息

如果生命周期脚本存在但在执行过程中失败,您将收到一条包含 CloudWatch 日志组名称和日志流名称的错误消息。如果多个实例出现生命周期脚本故障,则错误消息将仅显示一个失败的实例,但日志组应包含所有实例的流。

您可以通过运行 DescribeClusterAPI 或在 SageMaker 控制台中查看集群详细信息页面来查看错误消息。控制台中提供了 “查看生命周期脚本日志” 按钮,可直接导航到 CloudWatch 日志流。错误消息采用以下格式:

Instance [instance-id] failed to provision with the following error: "Lifecycle scripts did not run successfully. To view lifecycle script logs, visit log group ‘/aws/sagemaker/Clusters/[cluster-name]/[cluster-id]' and log stream ‘LifecycleConfig/[instance-group-name]/[instance-id]’. If you cannot find corresponding lifecycle script logs in CloudWatch, please make sure you follow one of the options here: https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-hyperpod-faq-slurm.html#hyperpod-faqs-q1.” Note that multiple instances may be impacted.

标注资源

Amazon 标签系统有助于管理、识别、组织、搜索和筛选资源。 SageMaker HyperPod 支持标记,因此您可以将群集作为 Amazon 资源进行管理。在创建集群或编辑现有集群期间,您可以为集群添加或编辑标签。要了解有关标记的更多一般信息,请参阅标记 Amazon 资源

使用 SageMaker HyperPod 控制台 UI

创建新集群编辑集群时,您可以添加、删除或编辑标签。

使用 SageMaker HyperPod APIs

当您以 JSON 格式编写CreateClusterUpdateClusterAPI 请求文件时,请编辑该Tags部分。

使用适用于 AI 的 Amazon CLI SageMaker 标记命令

要标记一个集群

按如下方式使用 aws sagemaker add-tags

aws sagemaker add-tags --resource-arn cluster_ARN --tags Key=string,Value=string

要取消标记一个集群

按如下方式使用 aws sagemaker delete-tags

aws sagemaker delete-tags --resource-arn cluster_ARN --tag-keys "tag_key"

列出资源的标签

按如下方式使用 aws sagemaker list-tags

aws sagemaker list-tags --resource-arn cluster_ARN