Stage where the service specification file is located.
compute_pool
required、string
Compute pool where the service runs.
spec_file
required、string
Path to service specification file on the stage.
identifier
optional、string
实体的 Snowflake 标识符。该值可以采用以下形式:
字符串标识符文本
identifier:my-service
Both unquoted and quoted identifiers are supported. To use quoted identifiers, include the surrounding quotes in the YAML value (for example, ’”My Image Repository").
An error occurs if you specify a schema or database and use a fully qualified name in the name property (such as mydb.schema1.my-app).
min_instances
optional、string
要运行的最小服务实例数。
Default: 1
max_instances
optional、string
Maximum number of service instances to run.
query_warehouse
optional、string
Warehouse to use if a service container connects to Snowflake to execute a query without explicitly specifying a warehouse to use.
auto_resume
optional、string
在调用服务函数或入口时是否自动恢复。
Default: True
external_access_integrations
optional、string sequence
Names of external access integrations needed for this entity to access external networks.
secrets
optional、dictionary
Names and values of secrets variables so that you can use the variables to reference the secrets.
artifacts
optional、string sequence
要添加到部署根的文件源和目标对的列表。您可以使用以下工件属性:
src: Path to the code source file or files
dest: Path to the directory to deploy the artifacts.
Destination paths that reference directories must end with a /. A glob pattern’s destination that does not end with a / results in an error. If omitted, dest defaults to the same string as src.
You can also pass in a string for each item instead of a dict, in which case the value is treated as both src and dest.
If src refers to just one file (not a glob), dest can refer to a target <path> or a <path/name>.
You can also pass in a string for each item instead of a dict, in which case the value is treated as both src and dest.
comment
optional、string
Comments to associate with the compute pool.
tags
optional、Tag sequence
Tag names and values for the compute pool. For more information, see Tag quotas
要创建和部署服务,请执行以下操作:
将当前目录更改为包含项目定义文件的目录。
Run a snow spcs service deploy command similar to the following:
snow spcs servicedeploy
+---------------------------------------------------------------------+|key|value||--------+------------------------------------------------------------|| status |Service MY_SERVICE successfully created.|+---------------------------------------------------------------------+
+-------------------------------------------+|key|value||--------+----------------------------------|| status |Statement executed successfully.|+-------------------------------------------+
To resume a suspended service, enter a snow spcs service resume command similar to the following:
snow spcs serviceresume echo_service
+-------------------------------------------+|key|value||--------+----------------------------------|| status |Statement executed successfully.|+-------------------------------------------+
获取有关服务的状态信息
Note
当前角色必须对服务具有 MONITOR 权限才能获取服务状态。
列出所有服务
The snow spcs service list command returns an overview of all services, including the runtime state of the services, such as PENDING or RUNNING, and the upgrading status. To get the status of all services, enter a command similar to the following:
You can list service’s instances and containers with the snow spcs service list-instances and snow spcs service list-containers commands, respectively.
You can manage access to individual endpoints exposed by a service by defining service roles and permissions in the service specification. For more information about how to use service roles, see GRANT SERVICE ROLE.
+-------------------------------------------+|key|value||--------+----------------------------------|| status |Statement executed successfully.|+-------------------------------------------+
+-------------------------------------------+|key|value||--------+----------------------------------|| status |Statement executed successfully.|+-------------------------------------------+
显示命名服务的日志
Note
当前角色必须具有对服务的 MONITOR 权限才能显示日志。
To display local logs for a named service, enter a snow spcs service logs command similar to the following:
snow spcs service logs "service_1" --container-name "container_1" --instance-id"0"
+-------------------------------------------+|key|value||--------+----------------------------------|| status |Statement executed successfully.|+-------------------------------------------+