

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 停止建立解決方案版本
<a name="stop-solution-version"></a>

如果您的解決方案版本狀態為 CREATE\$1PENDING 或 CREATE\$1IN\$1PROGRESS，您可以使用 Amazon Personalize 主控台或 [StopSolutionVersionCreation](API_StopSolutionVersionCreation.md)操作來停止建立解決方案版本 （停止訓練模型）。您無法在解決方案版本停止後繼續建立解決方案版本。在建立解決方案版本停止之前，您需要支付使用的資源費用。

停止建立解決方案版本會結束模型訓練，但不會刪除解決方案版本。您仍然可以在 Amazon Personalize 主控台和 [DescribeSolutionVersion](API_DescribeSolutionVersion.md)操作中檢視解決方案版本詳細資訊。

您可以使用 Amazon Personalize 主控台、 AWS Command Line Interface (AWS CLI) 或 AWS SDKs 來停止解決方案版本建立程序。

**Topics**
+ [停止建立解決方案版本 （主控台）](#stop-solution-version-console)
+ [停止建立解決方案版本 (AWS CLI)](#stop-solution-version-cli)
+ [停止建立解決方案版本 (AWS SDKs)](#stop-solution-version-sdk)

## 停止建立解決方案版本 （主控台）
<a name="stop-solution-version-console"></a>

如果您的解決方案版本狀態為 CREATE\$1PENDING 或 CREATE\$1IN\$1PROGRESS，您可以停止建立解決方案版本 （停止訓練模型）。

**停止建立解決方案版本 （主控台）**

1. 在 [https://console.aws.amazon.com/personalize/home](https://console.aws.amazon.com/personalize/home)：// 開啟 Amazon Personalize 主控台並登入您的帳戶。

1. 在**資料集群組**頁面上，選擇具有您要停止之解決方案版本的資料集群組。

1. 在導覽窗格中，選擇**解決方案和配方**。

1. 在**解決方案和配方**頁面上，選擇具有您要停止之解決方案版本的解決方案。

1. 在**解決方案版本**中，選擇您要停止的解決方案版本。

1. 在解決方案版本詳細資訊頁面上，選擇**停止建立**。根據解決方案版本的原始狀態，解決方案版本狀態會變更，如下所示：
   + CREATE\$1PENDING 變更為 CREATE\$1STOPPED。
   + CREATE\$1IN\$1PROGRESS 變更為 CREATE\$1STOPPING，然後變更 CREATE\$1STOPPED。

## 停止建立解決方案版本 (AWS CLI)
<a name="stop-solution-version-cli"></a>

如果您的解決方案版本狀態為 CREATE\$1PENDING 或 CREATE\$1IN\$1PROGRESS，您可以停止建立解決方案版本 （停止訓練模型）。使用以下`stop-solution-version-creation`命令來停止使用 建立解決方案版本 AWS CLI。`solution version arn` 以您想要停止的解決方案版本的 Amazon Resource Name (ARN) 取代 。您需要支付直到建立解決方案版本停止為止所使用的資源費用。

```
aws personalize stop-solution-version-creation \
    --solution-version-arn solution version arn
```

使用 `describe-solution-version`命令檢查解決方案版本的訓練狀態。

```
aws personalize describe-solution-version \
    --solution-version-arn solution version arn
```

根據解決方案版本的原始狀態，解決方案版本狀態會變更，如下所示：
+ CREATE\$1PENDING 變更為 CREATE\$1STOPPED。

  
+ CREATE\$1IN\$1PROGRESS 變更為 CREATE\$1STOPPING，然後變更 CREATE\$1STOPPED

## 停止建立解決方案版本 (AWS SDKs)
<a name="stop-solution-version-sdk"></a>

如果您的解決方案版本狀態為 CREATE\$1PENDING 或 CREATE\$1IN\$1PROGRESS，您可以停止建立解決方案版本 （停止訓練模型）。下列程式碼示範如何使用 適用於 Python (Boto3) 的 AWS SDK 或 停止建立解決方案版本 AWS SDK for Java 2.x。在建立解決方案版本停止之前，您需要支付使用的資源費用。

------
#### [ SDK for Python (Boto3) ]

使用下列`stop_solution_version_creation`方法停止建立解決方案版本。`solution_version_arn` 以您想要停止的解決方案版本的 Amazon Resource Name (ARN) 取代 。方法使用 [DescribeSolutionVersion](API_DescribeSolutionVersion.md)操作來擷取解決方案版本的狀態。

```
import boto3

personalize = boto3.client('personalize')

response = personalize.stop_solution_version_creation(
    solutionVersionArn = solution_version_arn
)

# Use the solution version ARN to get the solution version status.
solution_version_description = personalize.describe_solution_version(
    solutionVersionArn = solution_version_arn)['solutionVersion']
print('Solution version status: ' + solution_version_description['status'])
```

------
#### [ SDK for Java 2.x ]

使用以下`stopSolutionVersionCreation`方法停止建立解決方案版本。將 Amazon Personalize 服務用戶端和您要停止建立之解決方案版本的 Amazon Resource Name (ARN) 做為參數傳遞。下列程式碼使用 [DescribeSolutionVersion](API_DescribeSolutionVersion.md)操作來擷取解決方案版本的狀態。

```
public static void stopSolutionVersionCreation(PersonalizeClient personalizeClient, String solutionVersionArn) {
    String solutionVersionStatus = "";
    
    StopSolutionVersionCreationRequest stopSolutionVersionCreationRequest = StopSolutionVersionCreationRequest.builder()
        .solutionVersionArn(solutionVersionArn)
        .build();
    
    personalizeClient.stopSolutionVersionCreation(stopSolutionVersionCreationRequest);
    
    // Use the solution version ARN to get the solution version status.
    DescribeSolutionVersionRequest describeSolutionVersionRequest = DescribeSolutionVersionRequest.builder() 
        .solutionVersionArn(solutionVersionArn)
        .build();
                    
    solutionVersionStatus = personalizeClient.describeSolutionVersion(describeSolutionVersionRequest)
        .solutionVersion()
        .status();
    System.out.println("Solution version status: " + solutionVersionStatus);
}
```

------

根據解決方案版本的原始狀態，解決方案版本狀態會變更，如下所示：
+ CREATE\$1PENDING 變更為 CREATE\$1STOPPED。

  
+ CREATE\$1IN\$1PROGRESS 變更為 CREATE\$1STOPPING，然後變更 CREATE\$1STOPPED。