Updates an Amazon Personalize solution to use a different automatic training configuration. When you update a solution, you can change whether the solution uses automatic training, and you can change the training frequency. For more information about updating a solution, see Updating a solution.
A solution update can be in one of the following states:
CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
To get the status of a solution update, call the DescribeSolution API operation and find the status in the latestSolutionUpdate.
Parameters:
-
solution_arn
(Arn)
–
The Amazon Resource Name (ARN) of the solution to update.
-
perform_auto_training
(Optional[PerformAutoTraining], default:
None
)
–
Whether the solution uses automatic training to create new solution versions (trained models). You can change the training frequency by specifying a schedulingExpression in the AutoTrainingConfig as part of solution configuration.
If you turn on automatic training, the first automatic training starts within one hour after the solution update completes. If you manually create a solution version within the hour, the solution skips the first automatic training. For more information about automatic training, see Configuring automatic training.
After training starts, you can get the solution version's Amazon Resource Name (ARN) with the ListSolutionVersions API operation. To get its status, use the DescribeSolutionVersion.
-
perform_incremental_update
(Optional[PerformIncrementalUpdate], default:
None
)
–
Whether to perform incremental training updates on your model. When enabled, this allows the model to learn from new data more frequently without requiring full retraining, which enables near real-time personalization. This parameter is supported only for solutions that use the semantic-similarity recipe.
-
solution_update_config
(Optional[SolutionUpdateConfig], default:
None
)
–
The new configuration details of the solution.
Raises:
Source code in docs_src/capo_personalize/_services/personalize.py
| def update_solution(
self,
solution_arn: "capo_personalize.types.arn.Arn",
*,
config_overrides: Optional[PersonalizeClientConfig] = None,
perform_auto_training: Optional[
"capo_personalize.types.perform_auto_training.PerformAutoTraining"
] = None,
perform_incremental_update: Optional[
"capo_personalize.types.perform_incremental_update.PerformIncrementalUpdate"
] = None,
solution_update_config: Optional[
"capo_personalize.types.solution_update_config.SolutionUpdateConfig"
] = None,
) -> "capo_personalize.types.update_solution_response.UpdateSolutionResponse":
"""<p>Updates an Amazon Personalize solution to use a different automatic training configuration. When you update a solution, you can change whether the solution uses automatic training, and you can change the training frequency. For more information about updating a solution, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/updating-solution.html">Updating a solution</a>.</p> <p>A solution update can be in one of the following states:</p> <p>CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED</p> <p>To get the status of a solution update, call the <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeSolution.html">DescribeSolution</a> API operation and find the status in the <code>latestSolutionUpdate</code>. </p>
Args:
solution_arn: <p>The Amazon Resource Name (ARN) of the solution to update.</p>
perform_auto_training: <p>Whether the solution uses automatic training to create new solution versions (trained models). You can change the training frequency by specifying a <code>schedulingExpression</code> in the <code>AutoTrainingConfig</code> as part of solution configuration. </p> <p> If you turn on automatic training, the first automatic training starts within one hour after the solution update completes. If you manually create a solution version within the hour, the solution skips the first automatic training. For more information about automatic training, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/solution-config-auto-training.html">Configuring automatic training</a>. </p> <p> After training starts, you can get the solution version's Amazon Resource Name (ARN) with the <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_ListSolutionVersions.html">ListSolutionVersions</a> API operation. To get its status, use the <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeSolutionVersion.html">DescribeSolutionVersion</a>. </p>
perform_incremental_update: <p>Whether to perform incremental training updates on your model. When enabled, this allows the model to learn from new data more frequently without requiring full retraining, which enables near real-time personalization. This parameter is supported only for solutions that use the semantic-similarity recipe.</p>
solution_update_config: <p>The new configuration details of the solution.</p>
Raises:
capo_personalize.errors.invalid_input_exception.InvalidInputException: <p>Provide a valid value for the field or parameter.</p>
capo_personalize.errors.limit_exceeded_exception.LimitExceededException: <p>The limit on the number of requests per second has been exceeded.</p>
capo_personalize.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource is in use.</p>
capo_personalize.errors.resource_not_found_exception.ResourceNotFoundException: <p>Could not find the specified resource.</p>
capo_personalize.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_personalize.types.update_solution_request.UpdateSolutionRequest]",
) -> OperationResponse[
"capo_personalize.types.update_solution_response.UpdateSolutionResponse"
]:
import capo_personalize._operations.amazon_personalize.update_solution
output, http_response = (
capo_personalize._operations.amazon_personalize.update_solution.update_solution(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("UpdateSolution")
)
input_: capo_personalize.types.update_solution_request.UpdateSolutionRequest = {
"solution_arn": solution_arn
}
if perform_auto_training is not None:
input_["perform_auto_training"] = perform_auto_training
if perform_incremental_update is not None:
input_["perform_incremental_update"] = perform_incremental_update
if solution_update_config is not None:
input_["solution_update_config"] = solution_update_config
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|