stopInferenceExperiment method
Stops an inference experiment.
May throw ConflictException.
May throw ResourceNotFound.
Parameter modelVariantActions :
Array of key-value pairs, with names of variants mapped to actions. The
possible actions are the following:
-
Promote- Promote the shadow variant to a production variant -
Remove- Delete the variant -
Retain- Keep the variant as it is
Parameter name :
The name of the inference experiment to stop.
Parameter desiredModelVariants :
An array of ModelVariantConfig objects. There is one for each
variant that you want to deploy after the inference experiment stops. Each
ModelVariantConfig describes the infrastructure configuration
for deploying the corresponding variant.
Parameter desiredState :
The desired state of the experiment after stopping. The possible states
are the following:
-
Completed: The experiment completed successfully -
Cancelled: The experiment was canceled
Parameter reason :
The reason for stopping the experiment.
Implementation
Future<StopInferenceExperimentResponse> stopInferenceExperiment({
required Map<String, ModelVariantAction> modelVariantActions,
required String name,
List<ModelVariantConfig>? desiredModelVariants,
InferenceExperimentStopDesiredState? desiredState,
String? reason,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'SageMaker.StopInferenceExperiment'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ModelVariantActions':
modelVariantActions.map((k, e) => MapEntry(k, e.value)),
'Name': name,
if (desiredModelVariants != null)
'DesiredModelVariants': desiredModelVariants,
if (desiredState != null) 'DesiredState': desiredState.value,
if (reason != null) 'Reason': reason,
},
);
return StopInferenceExperimentResponse.fromJson(jsonResponse.body);
}