Managing services

Snowpark Container Services enables you to easily deploy, manage, and scale containerized applications. After you upload your application image to a repository in your account, you run your application containers as a service or a job. This topic explains working with services.

A service is long-running, like a web service, and does not end on its own. Snowflake manages running services. For example, if a service container exits, for whatever reason, Snowflake restarts that container so the service runs uninterrupted. If your service needs more resources, such as more compute power, Snowflake provisions additional nodes in the compute pool.

For more information about working with container services, see Snowpark Container Services: Working with services.

This topic shows how to do the following tasks with services:

For common operations, such as listing or dropping, Snowflake CLI uses snow object commands as described in Managing Snowflake objects.

How to create a Snowpark Container Services service

A Snowpark container service requires the following:

  • A compute pool: Snowflake runs your service in the specified compute pool.

  • A service specification file: This specification gives Snowflake the information needed to configure and run your service.

To create a service, enter a command similar to the following:

snow spcs service create "job_1" --compute-pool "pool_1" --spec-path "/some-dir/spec_file.yaml"
Copy

For more information, see Managing Snowflake objects.

How to suspend and resume a service

To suspend a named service, enter a command similar to the following:

snow spcs service suspend echo_service
Copy
+-------------------------------------------+
| key    | value                            |
|--------+----------------------------------|
| status | Statement executed successfully. |
+-------------------------------------------+

To resume a suspended service, enter a command similar to the following:

snow spcs service resume echo_service
Copy
+-------------------------------------------+
| key    | value                            |
|--------+----------------------------------|
| status | Statement executed successfully. |
+-------------------------------------------+

How to get the status of a service

Note

The current role must have MONITOR privilege on the service to get its status.

To get the status of a named service, enter a command similar to the following:

snow spcs service status "service_1"
Copy

How to list the endpoints in a service

To to list the endpoints a named service, enter a command similar to the following:

snow spcs service list-endpoints echo_service
Copy
+--------------+------+----------+-----------------+-----------------------------------------+
| name         | port | protocol | ingress_enabled | ingress_url                             |
|--------------+------+----------+-----------------+-----------------------------------------|
| echoendpoint | 8000 | TCP      | true            | org-id-acct-id.snowflakecomputing.app   |
+--------------+------+----------+-----------------+-----------------------------------------+

How to set and unset a service’s properties or parameters

Note

The current role must have OPERATE privilege on the service to set properties.

To set a service’s property or parameter, enter a command similar to the following:

snow spcs service set echo_service --min-instances 2 --max-instances 4
Copy
+-------------------------------------------+
| key    | value                            |
|--------+----------------------------------|
| status | Statement executed successfully. |
+-------------------------------------------+

To reset a service’s property or parameter to its default value, enter a command similar to the following:

snow spcs compute-pool unset tutorial_compute_pool --auto-resume
Copy
+-------------------------------------------+
| key    | value                            |
|--------+----------------------------------|
| status | Statement executed successfully. |
+-------------------------------------------+

How to display logs for a named service

Note

The current role must have MONITOR privilege on the service to display logs.

To display local logs for a named service, enter a command similar to the following:

snow spcs service logs "service_1" --container-name "container_1" --instance-id "0"
Copy

How to upgrade a named service

Note

The current role must have OPERATE privilege on the service to upgrade it.

To upgrade a named service, enter a command similar to the following:

snow spcs service upgrade echo_service --spec-path spec.yml
Copy
+-------------------------------------------+
| key    | value                            |
|--------+----------------------------------|
| status | Statement executed successfully. |
+-------------------------------------------+