Skip to content

Commit

Permalink
Fixed after review
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-astus committed Jan 17, 2025
1 parent f689459 commit 88767b8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/snowflake/cli/_plugins/spcs/compute_pool/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
4 changes: 2 additions & 2 deletions src/snowflake/cli/_plugins/spcs/compute_pool/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
)
Expand Down

0 comments on commit 88767b8

Please sign in to comment.