-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added snow spcs service deploy command (#2026)
- Loading branch information
1 parent
774c9de
commit d2fe300
Showing
18 changed files
with
765 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from snowflake.cli._plugins.spcs.services.service_entity_model import ServiceEntityModel | ||
from snowflake.cli.api.entities.common import EntityBase | ||
|
||
|
||
class ServiceEntity(EntityBase[ServiceEntityModel]): | ||
pass |
33 changes: 33 additions & 0 deletions
33
src/snowflake/cli/_plugins/spcs/services/service_entity_model.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from pathlib import Path | ||
from typing import List, Literal, Optional | ||
|
||
from pydantic import Field | ||
from snowflake.cli._plugins.object.common import Tag | ||
from snowflake.cli.api.project.schemas.entities.common import ( | ||
EntityModelBaseWithArtifacts, | ||
ExternalAccessBaseModel, | ||
) | ||
from snowflake.cli.api.project.schemas.updatable_model import DiscriminatorField | ||
|
||
|
||
class ServiceEntityModel(EntityModelBaseWithArtifacts, ExternalAccessBaseModel): | ||
type: Literal["service"] = DiscriminatorField() # noqa: A003 | ||
stage: str = Field( | ||
title="Stage where the service specification file is located", default=None | ||
) | ||
compute_pool: str = Field(title="Compute pool to run the service on", default=None) | ||
spec_file: Path = Field( | ||
title="Path to service specification file on stage", default=None | ||
) | ||
min_instances: Optional[int] = Field( | ||
title="Minimum number of instances", default=None, ge=0 | ||
) | ||
max_instances: Optional[int] = Field( | ||
title="Maximum number of instances", default=None | ||
) | ||
query_warehouse: Optional[str] = Field( | ||
title="Warehouse to use if a service container connects to Snowflake to execute a query without explicitly specifying a warehouse to use", | ||
default=None, | ||
) | ||
tags: Optional[List[Tag]] = Field(title="Tag for the service", default=None) | ||
comment: Optional[str] = Field(title="Comment for the service", default=None) |
15 changes: 15 additions & 0 deletions
15
src/snowflake/cli/_plugins/spcs/services/service_project_paths.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from dataclasses import dataclass | ||
from pathlib import Path | ||
|
||
from snowflake.cli.api.project.project_paths import ProjectPaths, bundle_root | ||
|
||
|
||
@dataclass | ||
class ServiceProjectPaths(ProjectPaths): | ||
""" | ||
This class allows you to manage files paths related to given project. | ||
""" | ||
|
||
@property | ||
def bundle_root(self) -> Path: | ||
return bundle_root(self.project_root, "service") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.