Class CfnInferenceExperiment

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ITaggable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.101.0 (build b95fe5d)", date="2024-07-22T22:42:57.863Z") @Stability(Stable) public class CfnInferenceExperiment extends CfnResource implements IInspectable, ITaggable
Creates an inference experiment using the configurations specified in the request.

Use this API to setup and schedule an experiment to compare model variants on a Amazon SageMaker inference endpoint. For more information about inference experiments, see Shadow tests .

Amazon SageMaker begins your experiment at the scheduled time and routes traffic to your endpoint's model variants based on your specified configuration.

While the experiment is in progress or after it has concluded, you can view metrics that compare your model variants. For more information, see View, monitor, and edit shadow tests .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.sagemaker.*;
 CfnInferenceExperiment cfnInferenceExperiment = CfnInferenceExperiment.Builder.create(this, "MyCfnInferenceExperiment")
         .endpointName("endpointName")
         .modelVariants(List.of(ModelVariantConfigProperty.builder()
                 .infrastructureConfig(ModelInfrastructureConfigProperty.builder()
                         .infrastructureType("infrastructureType")
                         .realTimeInferenceConfig(RealTimeInferenceConfigProperty.builder()
                                 .instanceCount(123)
                                 .instanceType("instanceType")
                                 .build())
                         .build())
                 .modelName("modelName")
                 .variantName("variantName")
                 .build()))
         .name("name")
         .roleArn("roleArn")
         .type("type")
         // the properties below are optional
         .dataStorageConfig(DataStorageConfigProperty.builder()
                 .destination("destination")
                 // the properties below are optional
                 .contentType(CaptureContentTypeHeaderProperty.builder()
                         .csvContentTypes(List.of("csvContentTypes"))
                         .jsonContentTypes(List.of("jsonContentTypes"))
                         .build())
                 .kmsKey("kmsKey")
                 .build())
         .description("description")
         .desiredState("desiredState")
         .kmsKey("kmsKey")
         .schedule(InferenceExperimentScheduleProperty.builder()
                 .endTime("endTime")
                 .startTime("startTime")
                 .build())
         .shadowModeConfig(ShadowModeConfigProperty.builder()
                 .shadowModelVariants(List.of(ShadowModelVariantConfigProperty.builder()
                         .samplingPercentage(123)
                         .shadowModelVariantName("shadowModelVariantName")
                         .build()))
                 .sourceModelVariantName("sourceModelVariantName")
                 .build())
         .statusReason("statusReason")
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnInferenceExperiment

      protected CfnInferenceExperiment(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnInferenceExperiment

      protected CfnInferenceExperiment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnInferenceExperiment

      @Stability(Stable) public CfnInferenceExperiment(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnInferenceExperimentProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrArn

      @Stability(Stable) @NotNull public String getAttrArn()
      The ARN for your inference experiment.
    • getAttrCreationTime

      @Stability(Stable) @NotNull public String getAttrCreationTime()
      The timestamp at which the inference experiment was created.
    • getAttrEndpointMetadata

      @Stability(Stable) @NotNull public IResolvable getAttrEndpointMetadata()
      The metadata of the endpoint on which the inference experiment ran.
    • getAttrEndpointMetadataEndpointConfigName

      @Stability(Stable) @NotNull public String getAttrEndpointMetadataEndpointConfigName()
    • getAttrEndpointMetadataEndpointName

      @Stability(Stable) @NotNull public String getAttrEndpointMetadataEndpointName()
    • getAttrEndpointMetadataEndpointStatus

      @Stability(Stable) @NotNull public String getAttrEndpointMetadataEndpointStatus()
    • getAttrLastModifiedTime

      @Stability(Stable) @NotNull public String getAttrLastModifiedTime()
      The timestamp at which you last modified the inference experiment.
    • getAttrStatus

      @Stability(Stable) @NotNull public String getAttrStatus()
      The status of the inference experiment. The following are the possible statuses for an inference experiment:.

      • Creating - Amazon SageMaker is creating your experiment.
      • Created - Amazon SageMaker has finished the creation of your experiment and will begin the experiment at the scheduled time.
      • Updating - When you make changes to your experiment, your experiment shows as updating.
      • Starting - Amazon SageMaker is beginning your experiment.
      • Running - Your experiment is in progress.
      • Stopping - Amazon SageMaker is stopping your experiment.
      • Completed - Your experiment has completed.
      • Cancelled - When you conclude your experiment early using the StopInferenceExperiment API, or if any operation fails with an unexpected error, it shows as cancelled.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getTags in interface ITaggable
    • getEndpointName

      @Stability(Stable) @NotNull public String getEndpointName()
      The name of the endpoint.
    • setEndpointName

      @Stability(Stable) public void setEndpointName(@NotNull String value)
      The name of the endpoint.
    • getModelVariants

      @Stability(Stable) @NotNull public Object getModelVariants()
      An array of ModelVariantConfigSummary objects.
    • setModelVariants

      @Stability(Stable) public void setModelVariants(@NotNull IResolvable value)
      An array of ModelVariantConfigSummary objects.
    • setModelVariants

      @Stability(Stable) public void setModelVariants(@NotNull List<Object> value)
      An array of ModelVariantConfigSummary objects.
    • getName

      @Stability(Stable) @NotNull public String getName()
      The name of the inference experiment.
    • setName

      @Stability(Stable) public void setName(@NotNull String value)
      The name of the inference experiment.
    • getRoleArn

      @Stability(Stable) @NotNull public String getRoleArn()
      The ARN of the IAM role that Amazon SageMaker can assume to access model artifacts and container images, and manage Amazon SageMaker Inference endpoints for model deployment.
    • setRoleArn

      @Stability(Stable) public void setRoleArn(@NotNull String value)
      The ARN of the IAM role that Amazon SageMaker can assume to access model artifacts and container images, and manage Amazon SageMaker Inference endpoints for model deployment.
    • getType

      @Stability(Stable) @NotNull public String getType()
      The type of the inference experiment.
    • setType

      @Stability(Stable) public void setType(@NotNull String value)
      The type of the inference experiment.
    • getDataStorageConfig

      @Stability(Stable) @Nullable public Object getDataStorageConfig()
      The Amazon S3 location and configuration for storing inference request and response data.
    • setDataStorageConfig

      @Stability(Stable) public void setDataStorageConfig(@Nullable IResolvable value)
      The Amazon S3 location and configuration for storing inference request and response data.
    • setDataStorageConfig

      @Stability(Stable) public void setDataStorageConfig(@Nullable CfnInferenceExperiment.DataStorageConfigProperty value)
      The Amazon S3 location and configuration for storing inference request and response data.
    • getDescription

      @Stability(Stable) @Nullable public String getDescription()
      The description of the inference experiment.
    • setDescription

      @Stability(Stable) public void setDescription(@Nullable String value)
      The description of the inference experiment.
    • getDesiredState

      @Stability(Stable) @Nullable public String getDesiredState()
      The desired state of the experiment after stopping.

      The possible states are the following:.

    • setDesiredState

      @Stability(Stable) public void setDesiredState(@Nullable String value)
      The desired state of the experiment after stopping.

      The possible states are the following:.

    • getKmsKey

      @Stability(Stable) @Nullable public String getKmsKey()
      The AWS Key Management Service key that Amazon SageMaker uses to encrypt captured data at rest using Amazon S3 server-side encryption.
    • setKmsKey

      @Stability(Stable) public void setKmsKey(@Nullable String value)
      The AWS Key Management Service key that Amazon SageMaker uses to encrypt captured data at rest using Amazon S3 server-side encryption.
    • getSchedule

      @Stability(Stable) @Nullable public Object getSchedule()
      The duration for which the inference experiment ran or will run.
    • setSchedule

      @Stability(Stable) public void setSchedule(@Nullable IResolvable value)
      The duration for which the inference experiment ran or will run.
    • setSchedule

      @Stability(Stable) public void setSchedule(@Nullable CfnInferenceExperiment.InferenceExperimentScheduleProperty value)
      The duration for which the inference experiment ran or will run.
    • getShadowModeConfig

      @Stability(Stable) @Nullable public Object getShadowModeConfig()
      The configuration of ShadowMode inference experiment type, which shows the production variant that takes all the inference requests, and the shadow variant to which Amazon SageMaker replicates a percentage of the inference requests.
    • setShadowModeConfig

      @Stability(Stable) public void setShadowModeConfig(@Nullable IResolvable value)
      The configuration of ShadowMode inference experiment type, which shows the production variant that takes all the inference requests, and the shadow variant to which Amazon SageMaker replicates a percentage of the inference requests.
    • setShadowModeConfig

      @Stability(Stable) public void setShadowModeConfig(@Nullable CfnInferenceExperiment.ShadowModeConfigProperty value)
      The configuration of ShadowMode inference experiment type, which shows the production variant that takes all the inference requests, and the shadow variant to which Amazon SageMaker replicates a percentage of the inference requests.
    • getStatusReason

      @Stability(Stable) @Nullable public String getStatusReason()
      The error message for the inference experiment status result.
    • setStatusReason

      @Stability(Stable) public void setStatusReason(@Nullable String value)
      The error message for the inference experiment status result.
    • getTagsRaw

      @Stability(Stable) @Nullable public List<CfnTag> getTagsRaw()
      An array of key-value pairs to apply to this resource.
    • setTagsRaw

      @Stability(Stable) public void setTagsRaw(@Nullable List<CfnTag> value)
      An array of key-value pairs to apply to this resource.