
com.amazonaws.services.sagemaker.model.ProductionVariant Maven / Gradle / Ivy
/*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.sagemaker.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Identifies a model that you want to host and the resources to deploy for hosting it. If you are deploying multiple
* models, tell Amazon SageMaker how to distribute traffic among the models by specifying variant weights.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ProductionVariant implements Serializable, Cloneable, StructuredPojo {
/**
*
* The name of the production variant.
*
*/
private String variantName;
/**
*
* The name of the model that you want to host. This is the name that you specified when creating the model.
*
*/
private String modelName;
/**
*
* Number of instances to launch initially.
*
*/
private Integer initialInstanceCount;
/**
*
* The ML compute instance type.
*
*/
private String instanceType;
/**
*
* Determines initial traffic distribution among all of the models that you specify in the endpoint configuration.
* The traffic to a production variant is determined by the ratio of the VariantWeight
to the sum of
* all VariantWeight
values across all ProductionVariants. If unspecified, it defaults to 1.0.
*
*/
private Float initialVariantWeight;
/**
*
* The size of the Elastic Inference (EI) instance to use for the production variant. EI instances provide on-demand
* GPU computing for inference. For more information, see Using Elastic Inference in Amazon SageMaker.
*
*/
private String acceleratorType;
/**
*
* The name of the production variant.
*
*
* @param variantName
* The name of the production variant.
*/
public void setVariantName(String variantName) {
this.variantName = variantName;
}
/**
*
* The name of the production variant.
*
*
* @return The name of the production variant.
*/
public String getVariantName() {
return this.variantName;
}
/**
*
* The name of the production variant.
*
*
* @param variantName
* The name of the production variant.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ProductionVariant withVariantName(String variantName) {
setVariantName(variantName);
return this;
}
/**
*
* The name of the model that you want to host. This is the name that you specified when creating the model.
*
*
* @param modelName
* The name of the model that you want to host. This is the name that you specified when creating the model.
*/
public void setModelName(String modelName) {
this.modelName = modelName;
}
/**
*
* The name of the model that you want to host. This is the name that you specified when creating the model.
*
*
* @return The name of the model that you want to host. This is the name that you specified when creating the model.
*/
public String getModelName() {
return this.modelName;
}
/**
*
* The name of the model that you want to host. This is the name that you specified when creating the model.
*
*
* @param modelName
* The name of the model that you want to host. This is the name that you specified when creating the model.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ProductionVariant withModelName(String modelName) {
setModelName(modelName);
return this;
}
/**
*
* Number of instances to launch initially.
*
*
* @param initialInstanceCount
* Number of instances to launch initially.
*/
public void setInitialInstanceCount(Integer initialInstanceCount) {
this.initialInstanceCount = initialInstanceCount;
}
/**
*
* Number of instances to launch initially.
*
*
* @return Number of instances to launch initially.
*/
public Integer getInitialInstanceCount() {
return this.initialInstanceCount;
}
/**
*
* Number of instances to launch initially.
*
*
* @param initialInstanceCount
* Number of instances to launch initially.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ProductionVariant withInitialInstanceCount(Integer initialInstanceCount) {
setInitialInstanceCount(initialInstanceCount);
return this;
}
/**
*
* The ML compute instance type.
*
*
* @param instanceType
* The ML compute instance type.
* @see ProductionVariantInstanceType
*/
public void setInstanceType(String instanceType) {
this.instanceType = instanceType;
}
/**
*
* The ML compute instance type.
*
*
* @return The ML compute instance type.
* @see ProductionVariantInstanceType
*/
public String getInstanceType() {
return this.instanceType;
}
/**
*
* The ML compute instance type.
*
*
* @param instanceType
* The ML compute instance type.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ProductionVariantInstanceType
*/
public ProductionVariant withInstanceType(String instanceType) {
setInstanceType(instanceType);
return this;
}
/**
*
* The ML compute instance type.
*
*
* @param instanceType
* The ML compute instance type.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ProductionVariantInstanceType
*/
public ProductionVariant withInstanceType(ProductionVariantInstanceType instanceType) {
this.instanceType = instanceType.toString();
return this;
}
/**
*
* Determines initial traffic distribution among all of the models that you specify in the endpoint configuration.
* The traffic to a production variant is determined by the ratio of the VariantWeight
to the sum of
* all VariantWeight
values across all ProductionVariants. If unspecified, it defaults to 1.0.
*
*
* @param initialVariantWeight
* Determines initial traffic distribution among all of the models that you specify in the endpoint
* configuration. The traffic to a production variant is determined by the ratio of the
* VariantWeight
to the sum of all VariantWeight
values across all
* ProductionVariants. If unspecified, it defaults to 1.0.
*/
public void setInitialVariantWeight(Float initialVariantWeight) {
this.initialVariantWeight = initialVariantWeight;
}
/**
*
* Determines initial traffic distribution among all of the models that you specify in the endpoint configuration.
* The traffic to a production variant is determined by the ratio of the VariantWeight
to the sum of
* all VariantWeight
values across all ProductionVariants. If unspecified, it defaults to 1.0.
*
*
* @return Determines initial traffic distribution among all of the models that you specify in the endpoint
* configuration. The traffic to a production variant is determined by the ratio of the
* VariantWeight
to the sum of all VariantWeight
values across all
* ProductionVariants. If unspecified, it defaults to 1.0.
*/
public Float getInitialVariantWeight() {
return this.initialVariantWeight;
}
/**
*
* Determines initial traffic distribution among all of the models that you specify in the endpoint configuration.
* The traffic to a production variant is determined by the ratio of the VariantWeight
to the sum of
* all VariantWeight
values across all ProductionVariants. If unspecified, it defaults to 1.0.
*
*
* @param initialVariantWeight
* Determines initial traffic distribution among all of the models that you specify in the endpoint
* configuration. The traffic to a production variant is determined by the ratio of the
* VariantWeight
to the sum of all VariantWeight
values across all
* ProductionVariants. If unspecified, it defaults to 1.0.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ProductionVariant withInitialVariantWeight(Float initialVariantWeight) {
setInitialVariantWeight(initialVariantWeight);
return this;
}
/**
*
* The size of the Elastic Inference (EI) instance to use for the production variant. EI instances provide on-demand
* GPU computing for inference. For more information, see Using Elastic Inference in Amazon SageMaker.
*
*
* @param acceleratorType
* The size of the Elastic Inference (EI) instance to use for the production variant. EI instances provide
* on-demand GPU computing for inference. For more information, see Using Elastic Inference in Amazon
* SageMaker.
* @see ProductionVariantAcceleratorType
*/
public void setAcceleratorType(String acceleratorType) {
this.acceleratorType = acceleratorType;
}
/**
*
* The size of the Elastic Inference (EI) instance to use for the production variant. EI instances provide on-demand
* GPU computing for inference. For more information, see Using Elastic Inference in Amazon SageMaker.
*
*
* @return The size of the Elastic Inference (EI) instance to use for the production variant. EI instances provide
* on-demand GPU computing for inference. For more information, see Using Elastic Inference in Amazon
* SageMaker.
* @see ProductionVariantAcceleratorType
*/
public String getAcceleratorType() {
return this.acceleratorType;
}
/**
*
* The size of the Elastic Inference (EI) instance to use for the production variant. EI instances provide on-demand
* GPU computing for inference. For more information, see Using Elastic Inference in Amazon SageMaker.
*
*
* @param acceleratorType
* The size of the Elastic Inference (EI) instance to use for the production variant. EI instances provide
* on-demand GPU computing for inference. For more information, see Using Elastic Inference in Amazon
* SageMaker.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ProductionVariantAcceleratorType
*/
public ProductionVariant withAcceleratorType(String acceleratorType) {
setAcceleratorType(acceleratorType);
return this;
}
/**
*
* The size of the Elastic Inference (EI) instance to use for the production variant. EI instances provide on-demand
* GPU computing for inference. For more information, see Using Elastic Inference in Amazon SageMaker.
*
*
* @param acceleratorType
* The size of the Elastic Inference (EI) instance to use for the production variant. EI instances provide
* on-demand GPU computing for inference. For more information, see Using Elastic Inference in Amazon
* SageMaker.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ProductionVariantAcceleratorType
*/
public ProductionVariant withAcceleratorType(ProductionVariantAcceleratorType acceleratorType) {
this.acceleratorType = acceleratorType.toString();
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getVariantName() != null)
sb.append("VariantName: ").append(getVariantName()).append(",");
if (getModelName() != null)
sb.append("ModelName: ").append(getModelName()).append(",");
if (getInitialInstanceCount() != null)
sb.append("InitialInstanceCount: ").append(getInitialInstanceCount()).append(",");
if (getInstanceType() != null)
sb.append("InstanceType: ").append(getInstanceType()).append(",");
if (getInitialVariantWeight() != null)
sb.append("InitialVariantWeight: ").append(getInitialVariantWeight()).append(",");
if (getAcceleratorType() != null)
sb.append("AcceleratorType: ").append(getAcceleratorType());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ProductionVariant == false)
return false;
ProductionVariant other = (ProductionVariant) obj;
if (other.getVariantName() == null ^ this.getVariantName() == null)
return false;
if (other.getVariantName() != null && other.getVariantName().equals(this.getVariantName()) == false)
return false;
if (other.getModelName() == null ^ this.getModelName() == null)
return false;
if (other.getModelName() != null && other.getModelName().equals(this.getModelName()) == false)
return false;
if (other.getInitialInstanceCount() == null ^ this.getInitialInstanceCount() == null)
return false;
if (other.getInitialInstanceCount() != null && other.getInitialInstanceCount().equals(this.getInitialInstanceCount()) == false)
return false;
if (other.getInstanceType() == null ^ this.getInstanceType() == null)
return false;
if (other.getInstanceType() != null && other.getInstanceType().equals(this.getInstanceType()) == false)
return false;
if (other.getInitialVariantWeight() == null ^ this.getInitialVariantWeight() == null)
return false;
if (other.getInitialVariantWeight() != null && other.getInitialVariantWeight().equals(this.getInitialVariantWeight()) == false)
return false;
if (other.getAcceleratorType() == null ^ this.getAcceleratorType() == null)
return false;
if (other.getAcceleratorType() != null && other.getAcceleratorType().equals(this.getAcceleratorType()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getVariantName() == null) ? 0 : getVariantName().hashCode());
hashCode = prime * hashCode + ((getModelName() == null) ? 0 : getModelName().hashCode());
hashCode = prime * hashCode + ((getInitialInstanceCount() == null) ? 0 : getInitialInstanceCount().hashCode());
hashCode = prime * hashCode + ((getInstanceType() == null) ? 0 : getInstanceType().hashCode());
hashCode = prime * hashCode + ((getInitialVariantWeight() == null) ? 0 : getInitialVariantWeight().hashCode());
hashCode = prime * hashCode + ((getAcceleratorType() == null) ? 0 : getAcceleratorType().hashCode());
return hashCode;
}
@Override
public ProductionVariant clone() {
try {
return (ProductionVariant) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.sagemaker.model.transform.ProductionVariantMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}