

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

# モデルパッケージのステージとステータスを更新する例 (boto3)
<a name="model-registry-staging-construct-update-boto3"></a>

モデルパッケージのステージとステータスを更新するには、適切なアクセス許可を持つ実行ロールを引き受ける必要があります 以下は、 AWS SDK for Python (Boto3)を使用して [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateModelPackage.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateModelPackage.html) API でステージステータスを更新する方法の例を説明しています。

この例では、[https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateModelPackage.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateModelPackage.html) APIアクションの `ModelLifeCycle` ステージである `"Development"`条件キーとステージステータスである`"Approved"`条件キーが実行ロールに付与されています。`stage-description`に説明を追加することができます。詳細については「[ステージング構造の設定例](model-registry-staging-construct-set-up.md)」を参照してください。

```
from sagemaker import get_execution_role, session 
import boto3 

region = boto3.Session().region_name role = get_execution_role() 
sm_client = boto3.client('sagemaker', region_name=region)

model_package_update_input_dict = {
    "ModelLifeCycle" : { 
        "stage" : "Development",
        "stageStatus" : "Approved",
        "stageDescription" : "stage-description"
    }
} 
model_package_update_response = sm_client.update_model_package(**model_package_update_input_dict)
```