Skip to content

batch_add_cluster_nodes

batch_add_cluster_nodes(
    cluster_name: ClusterNameOrArn,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    client_token: Optional[String] = None,
    nodes_to_add: Optional[AddClusterNodeSpecificationList] = None,
) -> BatchAddClusterNodesResponse

Adds nodes to a HyperPod cluster by incrementing the target count for one or more instance groups. This operation returns a unique NodeLogicalId for each node being added, which can be used to track the provisioning status of the node. This API provides a safer alternative to UpdateCluster for scaling operations by avoiding unintended configuration changes.

This API is only supported for clusters using Continuous as the NodeProvisioningMode.

Parameters:

  • cluster_name (ClusterNameOrArn) –

    The name of the HyperPod cluster to which you want to add nodes.

  • client_token (Optional[String], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This token is valid for 8 hours. If you retry the request with the same client token within this timeframe and the same parameters, the API returns the same set of NodeLogicalIds with their latest status.

  • nodes_to_add (Optional[AddClusterNodeSpecificationList], default: None ) –

    A list of instance groups and the number of nodes to add to each. You can specify up to 5 instance groups in a single request, with a maximum of 50 nodes total across all instance groups.

Raises:

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def batch_add_cluster_nodes(
    self,
    cluster_name: "capo_sagemaker.types.cluster_name_or_arn.ClusterNameOrArn",
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    client_token: Optional["capo_sagemaker.types.string.String"] = None,
    nodes_to_add: Optional[
        "capo_sagemaker.types.add_cluster_node_specification_list.AddClusterNodeSpecificationList"
    ] = None,
) -> "capo_sagemaker.types.batch_add_cluster_nodes_response.BatchAddClusterNodesResponse":
    """<p>Adds nodes to a HyperPod cluster by incrementing the target count for one or more instance groups. This operation returns a unique <code>NodeLogicalId</code> for each node being added, which can be used to track the provisioning status of the node. This API provides a safer alternative to <code>UpdateCluster</code> for scaling operations by avoiding unintended configuration changes.</p> <note> <p>This API is only supported for clusters using <code>Continuous</code> as the <code>NodeProvisioningMode</code>.</p> </note>

    Args:
        cluster_name: <p>The name of the HyperPod cluster to which you want to add nodes.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This token is valid for 8 hours. If you retry the request with the same client token within this timeframe and the same parameters, the API returns the same set of <code>NodeLogicalIds</code> with their latest status.</p>
        nodes_to_add: <p>A list of instance groups and the number of nodes to add to each. You can specify up to 5 instance groups in a single request, with a maximum of 50 nodes total across all instance groups.</p>

    Raises:
        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.batch_add_cluster_nodes_request.BatchAddClusterNodesRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.batch_add_cluster_nodes_response.BatchAddClusterNodesResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.batch_add_cluster_nodes

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("BatchAddClusterNodes")
    )
    input_: capo_sagemaker.types.batch_add_cluster_nodes_request.BatchAddClusterNodesRequest = {
        "cluster_name": cluster_name
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if nodes_to_add is not None:
        input_["nodes_to_add"] = nodes_to_add

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