-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added snow spcs compute-pool deploy command #2001
Conversation
|
||
class ComputePoolEntityModel(EntityModelBase): | ||
type: Literal["compute-pool"] = DiscriminatorField() # noqa: A003 | ||
min_nodes: Optional[int] = Field(title="Minimum number of nodes", default=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This number should be greater than 0. Please add validator.
Also - documentation says it's a required parameter https://docs.snowflake.com/en/sql-reference/sql/create-compute-pool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
auto_suspend_seconds: Optional[int] = Field( | ||
title="Number of seconds of inactivity after which you want Snowflake to automatically suspend the compute pool", | ||
default=3600, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the command, there is also a comment
field - is there a reason ,that it was ommited here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
@@ -124,6 +136,7 @@ def create( | |||
), | |||
auto_suspend_secs: int = AutoSuspendSecsOption(), | |||
comment: Optional[str] = CommentOption(help=_COMMENT_HELP), | |||
replace: bool = ReplaceOption(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it should be set to False by default, to ensure backwards compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is
ReplaceOption = OverrideableOption(
False,
"--replace",
project_type="compute-pool", project_root=cli_context.project_root | ||
) | ||
|
||
if entity_id and entity_id not in compute_pools: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if entity_id and entity_id not in compute_pools: | |
if entity_id not in compute_pools: |
entity_id is a required parameter - if an empty string is passed current check wouldn't work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be required? I copied logic from Streamlit, you can not provide entity_id and it will work if in snowflake.yml is only one compute pool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, didn't notice that it defaults to None
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we know that entity_id
is a key in compute_pools
this check seems unnecesarry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to elif
@@ -39,7 +44,17 @@ def create( | |||
auto_suspend_secs: int, | |||
comment: Optional[str], | |||
if_not_exists: bool, | |||
replace: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this should be an optional parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ye, but flag is not optional, has default.
|
||
if replace: | ||
object_manager = ObjectManager() | ||
object_type = str(ObjectType.COMPUTE_POOL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
object_type = str(ObjectType.COMPUTE_POOL) | |
object_type = ObjectType.COMPUTE_POOL.sf_name |
It's the same, but seems more informative
88767b8
to
f9964e4
Compare
f9964e4
to
9d2b6eb
Compare
Pre-review checklist
Changes description
Added new command
snow spcs compute-pool deploy
using snowflake.yml.Added
--replace
flag forsnow spcs compute-pool create
command.