diff --git a/src/snowflake/cli/_plugins/spcs/compute_pool/commands.py b/src/snowflake/cli/_plugins/spcs/compute_pool/commands.py index 6916b7b633..9f4c67a736 100644 --- a/src/snowflake/cli/_plugins/spcs/compute_pool/commands.py +++ b/src/snowflake/cli/_plugins/spcs/compute_pool/commands.py @@ -184,8 +184,7 @@ def deploy( if entity_id and entity_id not in compute_pools: raise UsageError(f"No '{entity_id}' entity in project definition file.") - - if len(compute_pools.keys()) == 1: + elif len(compute_pools.keys()) == 1: entity_id = list(compute_pools.keys())[0] if entity_id is None: diff --git a/src/snowflake/cli/_plugins/spcs/compute_pool/compute_pool_entity_model.py b/src/snowflake/cli/_plugins/spcs/compute_pool/compute_pool_entity_model.py index 45854a496c..da99b441c0 100644 --- a/src/snowflake/cli/_plugins/spcs/compute_pool/compute_pool_entity_model.py +++ b/src/snowflake/cli/_plugins/spcs/compute_pool/compute_pool_entity_model.py @@ -7,7 +7,7 @@ class ComputePoolEntityModel(EntityModelBase): type: Literal["compute-pool"] = DiscriminatorField() # noqa: A003 - min_nodes: Optional[int] = Field(title="Minimum number of nodes", default=None) + min_nodes: int = Field(title="Minimum number of nodes", default=None, ge=0) max_nodes: Optional[int] = Field(title="Maximum number of nodes", default=None) instance_family: str = Field(title="Name of the instance family", default=None) auto_resume: Optional[bool] = Field( @@ -21,3 +21,4 @@ class ComputePoolEntityModel(EntityModelBase): title="Number of seconds of inactivity after which you want Snowflake to automatically suspend the compute pool", default=3600, ) + comment: Optional[str] = Field(title="Comment for the compute pool", default=None) diff --git a/src/snowflake/cli/_plugins/spcs/compute_pool/manager.py b/src/snowflake/cli/_plugins/spcs/compute_pool/manager.py index 5380bc6de4..aeed9a894c 100644 --- a/src/snowflake/cli/_plugins/spcs/compute_pool/manager.py +++ b/src/snowflake/cli/_plugins/spcs/compute_pool/manager.py @@ -49,7 +49,7 @@ def create( if replace: object_manager = ObjectManager() - object_type = str(ObjectType.COMPUTE_POOL) + object_type = ObjectType.COMPUTE_POOL.value.sf_name entity_id_fqn = FQN.from_string(pool_name) if object_manager.object_exists(object_type=object_type, fqn=entity_id_fqn): self.stop(pool_name) @@ -88,7 +88,7 @@ def deploy( auto_resume=compute_pool.auto_resume, initially_suspended=compute_pool.initially_suspended, auto_suspend_secs=compute_pool.auto_suspend_seconds, - comment=None, + comment=compute_pool.comment, if_not_exists=False, replace=replace, )