aws / sagemaker-core

Apache License 2.0
5 stars 3 forks source link

fix: fix issue with update method args #29

Closed benieric closed 4 months ago

benieric commented 4 months ago

Issue #, if available:https://github.com/aws/sagemaker-core/issues/7

Description of changes:

FROM:

def update(
    self,
) -> Optional["Cluster"]:
    logger.debug("Creating cluster resource.")
    client = SageMakerClient().client

    operation_input_args = {
        "ClusterName": self.cluster_name,
        "InstanceGroups": self.instance_groups,
    }
    logger.debug(f"Input request: {operation_input_args}")
    # serialize the input request
    operation_input_args = Cluster._serialize(operation_input_args)
    logger.debug(f"Serialized input request: {operation_input_args}")

    # create the resource
    response = client.update_cluster(**operation_input_args)
    logger.debug(f"Response: {response}")
    self.refresh()

    return self

TO:

def update(
    self,
    instance_groups: List[ClusterInstanceGroupSpecification], # only exclude resource attributes that are identifiers
) -> Optional["Cluster"]:
    logger.debug("Creating cluster resource.")
    client = SageMakerClient().client

    operation_input_args = {
        "ClusterName": self.cluster_name,
        "InstanceGroups": instance_groups,
    }
    logger.debug(f"Input request: {operation_input_args}")
    # serialize the input request
    operation_input_args = Cluster._serialize(operation_input_args)
    logger.debug(f"Serialized input request: {operation_input_args}")

    # create the resource
    response = client.update_cluster(**operation_input_args)
    logger.debug(f"Response: {response}")
    self.refresh()

    return self

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.