

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# SageMaker HyperPod クラスター管理
<a name="sagemaker-hyperpod-cluster-management-slurm"></a>

以下のトピックでは、SageMaker HyperPod クラスターのログ記録と管理について説明します。

## SageMaker HyperPod イベントのログ記録
<a name="sagemaker-hyperpod-cluster-management-slurm-logging-hyperpod-events"></a>

SageMaker HyperPod からのすべてのイベントとログは、ロググループ名 `/aws/sagemaker/Clusters/[ClusterName]/[ClusterID]` で Amazon CloudWatch に保存されます。`CreateCluster` API を呼び出すたびに、新しいロググループが作成されます。次のリストには、各ロググループで収集された使用可能なログストリームがすべて含まれています。


|  |  | 
| --- |--- |
| ロググループ名 | ログストリーム名 | 
| /aws/sagemaker/Clusters/[ClusterName]/[ClusterID] | LifecycleConfig/[instance-group-name]/[instance-id] | 

## インスタンスレベルでの SageMaker HyperPod のログ記録
<a name="sagemaker-hyperpod-cluster-management-slurm-logging-at-instance-level"></a>

クラスターインスタンスの設定中に CloudWatch に発行された LifecycleScript ログにアクセスできます。作成されたクラスター内の各インスタンスは、`LifecycleConfig/[instance-group-name]/[instance-id]` 形式によって区別できる別個のログストリームを生成します。

`/var/log/provision/provisioning.log` に書き込まれたすべてのログは、前の CloudWatch ストリームにアップロードされます。[https://github.com/aws-samples/awsome-distributed-training/tree/main/1.architectures/5.sagemaker-hyperpod/LifecycleScripts/base-config](https://github.com/aws-samples/awsome-distributed-training/tree/main/1.architectures/5.sagemaker-hyperpod/LifecycleScripts/base-config) のサンプル LifecycleScripts は、その `stdout` と `stderr` をこの場所にリダイレクトします。カスタムスクリプトを使用している場合、CloudWatch で利用できる `/var/log/provision/provisioning.log` の場所にログを書き込みます。

**ライフサイクルスクリプトログマーカー**

ライフサイクルスクリプトの 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 ロググループ名とログストリーム名を含むエラーメッセージが表示されます。複数のインスタンスでライフサイクルスクリプトに障害が発生した場合、エラーメッセージには失敗したインスタンスが 1 つだけ表示されますが、ロググループにはすべてのインスタンスのストリームが含まれている必要があります。

エラーメッセージを表示するには、[DescribeCluster](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeCluster.html) API を実行するか、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.
```

## リソースのタグ付け
<a name="sagemaker-hyperpod-cluster-management-slurm-tagging"></a>

AWS タグ付けシステムは、リソースの管理、識別、整理、検索、フィルタリングに役立ちます。SageMaker HyperPod はタグ付けをサポートしているため、クラスターを AWS リソースとして管理できます。既存のクラスターの作成または編集中に、クラスターのタグを追加または編集できます。タグ付け全般の詳細については、「[AWS リソースのタグ付け](https://docs.aws.amazon.com/tag-editor/latest/userguide/tagging.html)」を参照してください。

### SageMaker HyperPod コンソール UI の使用
<a name="sagemaker-hyperpod-cluster-management-slurm-tagging-in-console"></a>

[新しいクラスターを作成](sagemaker-hyperpod-operate-slurm-console-ui.md#sagemaker-hyperpod-operate-slurm-console-ui-create-cluster)するときと[クラスターを編集](sagemaker-hyperpod-operate-slurm-console-ui.md#sagemaker-hyperpod-operate-slurm-console-ui-edit-clusters)するとき、タグを追加、削除、または編集できます。

### SageMaker HyperPod API の使用
<a name="sagemaker-hyperpod-cluster-management-slurm-tagging-in-api-request"></a>

[CreateCluster](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateCluster.html) または [UpdateCluster](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateCluster.html) API リクエストファイルを JSON 形式で書き込むときは、`Tags` セクションを編集します。

### SageMaker AI の AWS CLI タグ付けコマンドの使用
<a name="sagemaker-hyperpod-cluster-management-slurm-tagging-using-cli"></a>

**クラスターにタグを付けるには**

[https://docs.aws.amazon.com/cli/latest/reference/sagemaker/add-tags.html](https://docs.aws.amazon.com/cli/latest/reference/sagemaker/add-tags.html) を次のように使用します。

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

**クラスターのタグを解除するには**

[https://docs.aws.amazon.com/cli/latest/reference/sagemaker/delete-tags.html](https://docs.aws.amazon.com/cli/latest/reference/sagemaker/delete-tags.html) を次のように使用します。

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

**リソースのタグを一覧表示するには**

[https://docs.aws.amazon.com/cli/latest/reference/sagemaker/list-tags.html](https://docs.aws.amazon.com/cli/latest/reference/sagemaker/list-tags.html) を次のように使用します。

```
aws sagemaker list-tags --resource-arn cluster_ARN
```