Skip to content

add_inference_gateway

add_inference_gateway(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    identifier: Optional[GlobalInferenceGatewayIdentifier] = None,
    cluster_arn: Optional[GlobalInferenceGatewayClusterArn] = None,
    namespace: Optional[GlobalInferenceGatewayKubernetesNamespace] = None,
    name: Optional[GlobalInferenceGatewayKubernetesResourceName] = None,
) -> AddInferenceGatewayResponse

Adds an in-cluster inference gateway to a global inference gateway. This operation is asynchronous: the in-cluster inference gateway starts in the ADDING status. To check its status, call ListInferenceGateways. If the in-cluster inference gateway is already in the global inference gateway, the operation succeeds and returns its current status. An in-cluster inference gateway can belong to only one global inference gateway. If it already belongs to another global inference gateway, the operation fails with ResourceInUse. The operation fails with ConflictException while another operation is in progress on the global inference gateway, or if the global inference gateway failed to create.

Parameters:

Raises:

  • ConflictException –

    There was a conflict when you attempted to modify a SageMaker entity such as an Experiment or Artifact.

  • ResourceInUse –

    Resource being accessed is in use.

  • ResourceLimitExceeded –

    You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.

  • ResourceNotFound –

    Resource being access is not found.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def add_inference_gateway(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    identifier: Optional[
        "capo_sagemaker.types.global_inference_gateway_identifier.GlobalInferenceGatewayIdentifier"
    ] = None,
    cluster_arn: Optional[
        "capo_sagemaker.types.global_inference_gateway_cluster_arn.GlobalInferenceGatewayClusterArn"
    ] = None,
    namespace: Optional[
        "capo_sagemaker.types.global_inference_gateway_kubernetes_namespace.GlobalInferenceGatewayKubernetesNamespace"
    ] = None,
    name: Optional[
        "capo_sagemaker.types.global_inference_gateway_kubernetes_resource_name.GlobalInferenceGatewayKubernetesResourceName"
    ] = None,
) -> "capo_sagemaker.types.add_inference_gateway_response.AddInferenceGatewayResponse":
    """Adds an in-cluster inference gateway to a global inference gateway. This operation is asynchronous: the in-cluster inference gateway starts in the `ADDING` status. To check its status, call `ListInferenceGateways`. If the in-cluster inference gateway is already in the global inference gateway, the operation succeeds and returns its current status. An in-cluster inference gateway can belong to only one global inference gateway. If it already belongs to another global inference gateway, the operation fails with `ResourceInUse`. The operation fails with `ConflictException` while another operation is in progress on the global inference gateway, or if the global inference gateway failed to create.

    Args:
        identifier: <p>The name, Amazon Resource Name (ARN), or ID of the global inference gateway.</p>
        cluster_arn: <p>The Amazon Resource Name (ARN) of the SageMaker HyperPod cluster that runs the in-cluster inference gateway. The cluster must be in the same account and partition as the global inference gateway. It can be in a different Region, but not in an opt-in Region.</p>
        namespace: <p>The Kubernetes namespace of the in-cluster inference gateway.</p>
        name: <p>The name of the <code>InferenceGatewayConfig</code> resource that defines the in-cluster inference gateway.</p>

    Raises:
        capo_sagemaker.errors.conflict_exception.ConflictException: <p>There was a conflict when you attempted to modify a SageMaker entity such as an <code>Experiment</code> or <code>Artifact</code>.</p>
        capo_sagemaker.errors.resource_in_use.ResourceInUse: <p>Resource being accessed is in use.</p>
        capo_sagemaker.errors.resource_limit_exceeded.ResourceLimitExceeded: <p> You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created. </p>
        capo_sagemaker.errors.resource_not_found.ResourceNotFound: <p>Resource being access is not found.</p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.add_inference_gateway_request.AddInferenceGatewayRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.add_inference_gateway_response.AddInferenceGatewayResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.add_inference_gateway

        output, http_response = (
            capo_sagemaker._operations.sage_maker.add_inference_gateway.add_inference_gateway(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AddInferenceGateway")
    )
    input_: capo_sagemaker.types.add_inference_gateway_request.AddInferenceGatewayRequest = {}
    if identifier is not None:
        input_["identifier"] = identifier
    if cluster_arn is not None:
        input_["cluster_arn"] = cluster_arn
    if namespace is not None:
        input_["namespace"] = namespace
    if name is not None:
        input_["name"] = name

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output