Skip to content

update_cluster async

update_cluster(
    cluster_identifier: ClusterIdentifier,
    *,
    config_overrides: Optional[AsyncPCSClientConfig] = None,
    client_token: Optional[SBClientToken] = None,
    slurm_configuration: Optional[UpdateClusterSlurmConfigurationRequest] = None,
    scheduler: Optional[UpdateSchedulerRequest] = None,
) -> UpdateClusterResponse

Updates a cluster configuration. You can update the scheduler version, modify scheduler settings, and update accounting configuration for an existing cluster. For more information about updating the scheduler version, see Updating the scheduler version on a cluster in the PCS User Guide.

You can only update clusters that are in ACTIVE, UPDATE_FAILED, or SUSPENDED state. All associated resources (queues and compute node groups) must be in ACTIVE state before you can update the cluster.

Parameters:

  • cluster_identifier (ClusterIdentifier) –

    The name or ID of the cluster to update.

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

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.

  • slurm_configuration (Optional[UpdateClusterSlurmConfigurationRequest], default: None ) –

    Additional options related to the Slurm scheduler.

  • scheduler (Optional[UpdateSchedulerRequest], default: None ) –

    The scheduler configuration to update for the cluster. Use this to update the scheduler version. For more information, see Updating the scheduler version on a cluster in the PCS User Guide.

Raises:

  • AccessDeniedException –

    You don't have permission to perform the action.

    Examples

    • The launch template instance profile doesn't pass iam:PassRole verification.

    • There is a mismatch between the account ID and cluster ID.

    • The cluster ID doesn't exist.

    • The EC2 instance isn't present.

  • ConflictException –

    Your request has conflicting operations. This can occur if you're trying to perform more than 1 operation on the same resource at the same time.

    Examples

    • A cluster with the same name already exists.

    • A cluster isn't in ACTIVE status.

    • A cluster to delete is in an unstable state. For example, because it still has ACTIVE node groups or queues.

    • A queue already exists in a cluster.

  • InternalServerException –

    PCS can't process your request right now. Try again later.

  • ResourceNotFoundException –

    The requested resource can't be found. The cluster, node group, or queue you're attempting to get, update, list, or delete doesn't exist.

    Examples

  • ThrottlingException –

    Your request exceeded a request rate quota. Check the resource's request rate quota and try again.

  • ValidationException –

    The request isn't valid.

    Examples

    • Your request contains malformed JSON or unsupported characters.

    • The scheduler version isn't supported.

    • There are networking related errors, such as network validation failure.

    • AMI type is CUSTOM and the launch template doesn't define the AMI ID, or the AMI type is AL2 and the launch template defines the AMI.

  • UnknownServiceError –

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

Source code in docs_src/capo_pcs/_services/async_pcs.py
async def update_cluster(
    self,
    cluster_identifier: "capo_pcs.types.cluster_identifier.ClusterIdentifier",
    *,
    config_overrides: Optional[AsyncPCSClientConfig] = None,
    client_token: Optional["capo_pcs.types.sb_client_token.SBClientToken"] = None,
    slurm_configuration: Optional[
        "capo_pcs.types.update_cluster_slurm_configuration_request.UpdateClusterSlurmConfigurationRequest"
    ] = None,
    scheduler: Optional[
        "capo_pcs.types.update_scheduler_request.UpdateSchedulerRequest"
    ] = None,
) -> "capo_pcs.types.update_cluster_response.UpdateClusterResponse":
    """<p>Updates a cluster configuration. You can update the scheduler version, modify scheduler settings, and update accounting configuration for an existing cluster. For more information about updating the scheduler version, see <a href="https://docs.aws.amazon.com/pcs/latest/userguide/working-with_clusters_version_update.html">Updating the scheduler version on a cluster</a> in the <i>PCS User Guide</i>. </p> <note> <p>You can only update clusters that are in <code>ACTIVE</code>, <code>UPDATE_FAILED</code>, or <code>SUSPENDED</code> state. All associated resources (queues and compute node groups) must be in <code>ACTIVE</code> state before you can update the cluster.</p> </note>

    Args:
        cluster_identifier: <p>The name or ID of the cluster to update.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.</p>
        slurm_configuration: <p>Additional options related to the Slurm scheduler.</p>
        scheduler: <p>The scheduler configuration to update for the cluster. Use this to update the scheduler version. For more information, see <a href="https://docs.aws.amazon.com/pcs/latest/userguide/working-with_clusters_version_update.html">Updating the scheduler version on a cluster</a> in the <i>PCS User Guide</i>.</p>

    Raises:
        capo_pcs.errors.access_denied_exception.AccessDeniedException: <p>You don't have permission to perform the action.</p> <p> <u>Examples</u> </p> <ul> <li> <p>The launch template instance profile doesn't pass <code>iam:PassRole</code> verification.</p> </li> <li> <p>There is a mismatch between the account ID and cluster ID.</p> </li> <li> <p>The cluster ID doesn't exist.</p> </li> <li> <p>The EC2 instance isn't present.</p> </li> </ul>
        capo_pcs.errors.conflict_exception.ConflictException: <p>Your request has conflicting operations. This can occur if you're trying to perform more than 1 operation on the same resource at the same time.</p> <p> <u>Examples</u> </p> <ul> <li> <p>A cluster with the same name already exists.</p> </li> <li> <p>A cluster isn't in <code>ACTIVE</code> status.</p> </li> <li> <p>A cluster to delete is in an unstable state. For example, because it still has <code>ACTIVE</code> node groups or queues.</p> </li> <li> <p>A queue already exists in a cluster.</p> </li> </ul>
        capo_pcs.errors.internal_server_exception.InternalServerException: <p>PCS can't process your request right now. Try again later.</p>
        capo_pcs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource can't be found. The cluster, node group, or queue you're attempting to get, update, list, or delete doesn't exist.</p> <p> <u>Examples</u> </p>
        capo_pcs.errors.throttling_exception.ThrottlingException: <p>Your request exceeded a request rate quota. Check the resource's request rate quota and try again.</p>
        capo_pcs.errors.validation_exception.ValidationException: <p>The request isn't valid.</p> <p> <u>Examples</u> </p> <ul> <li> <p>Your request contains malformed JSON or unsupported characters.</p> </li> <li> <p>The scheduler version isn't supported.</p> </li> <li> <p>There are networking related errors, such as network validation failure.</p> </li> <li> <p>AMI type is <code>CUSTOM</code> and the launch template doesn't define the AMI ID, or the AMI type is AL2 and the launch template defines the AMI.</p> </li> </ul>
        capo_pcs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_pcs.types.update_cluster_request.UpdateClusterRequest]",
    ) -> AsyncOperationResponse[
        "capo_pcs.types.update_cluster_response.UpdateClusterResponse"
    ]:
        import capo_pcs._operations.aws_parallel_computing_service.update_cluster

        (
            output,
            http_response,
        ) = await capo_pcs._operations.aws_parallel_computing_service.update_cluster.async_update_cluster(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateCluster")
    )
    input_: capo_pcs.types.update_cluster_request.UpdateClusterRequest = {
        "cluster_identifier": cluster_identifier
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if slurm_configuration is not None:
        input_["slurm_configuration"] = slurm_configuration
    if scheduler is not None:
        input_["scheduler"] = scheduler

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output