> ## Documentation Index
> Fetch the complete documentation index at: https://docs.winningvariant.com/llms.txt
> Use this file to discover all available pages before exploring further.

# App Configuration

> Managing and configuring the Winning Variant Snowflake Native App

## Roles

A user must be assigned the `admin` [application role](/snowflake-app-details#application-roles) to execute any of the examples described on this page.

## Manage Compute Pool

Winning Variant creates its own compute pool that it uses to run its services in an isolated environment. The `admin` application role is granted the following permissions: `OPERATE`, `MODIFY`, `USAGE`, `MONITOR` . This means that an `admin` can alter the compute pool directly.

<Note>
  All services are designed to run on a single instance, so there's no point in increasing the number of nodes in the compute pool as each service will still use just a single instance.
</Note>

## Manage Services

The Winning Variant services can be managed by an admin using the following stored procedures (all within the `management` schema):

| Procedure                   | Description                              |
| --------------------------- | ---------------------------------------- |
| `suspend_services()`        | Suspends all services.                   |
| `suspend_config_service()`  | Suspends just the configuration service. |
| `suspend_variant_service()` | Suspends just the variant service.       |
| `resume_services()`         | Resumes all services.                    |
| `resume_config_service()`   | Resumes the configuration service.       |
| `resume_variant_service()`  | Resumes the variant service.             |
| `get_service_status()`      | Gets the status of all services.         |
| `get_service_endpoints()`   | Shows ingress URLs for all services.     |

**Examples**

```SQL theme={null}
USE <application_name>;

-- Suspend all services
CALL management.suspend_services();

-- Check status of services
CALL management.get_service_status();
```

## Task Scheduling

Winning Variant maintains a few internal tasks whose schedules can be modified to fit your company's needs. Each task's schedule may be modifed with the following stored procedure:

`management.set_task_schedule(task_name VARCHAR, schedule VARCHAR)`

| **Parameter** | **Description**                                                                                                                                                                                                  |
| :------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `task_name`   | The name of the task to reschedule. Possible values are listed below.                                                                                                                                            |
| `schedule`    | A string defining the new schedule. Any string value compatible with the `SCHEDULE` parameter for [CREATE TASK](https://docs.snowflake.com/en/sql-reference/sql/create-task#optional-parameters) will work here. |

Available tasks are:

| **Task Name**                | **Description**                                                                                                                                                                                                                                                                | **Default Schedule**              |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------- |
| `log_load`                   | Loads new logs into tables for immediate analysis.                                                                                                                                                                                                                             | At the top of each hour.          |
| `assignments_cache_snapshot` | Takes a snapshot of the block storage volume that contains the internal assignment cache.                                                                                                                                                                                      | Nightly at midnight Pacific Time. |
| `variant_config_refresh`     | Forces a refresh of the configuration used by the Variant API.<br /><br />The configuration is updated in real time when an experiment is modified, but this is a "belt and suspenders" approach to make sure that it's correct at least hourly if something gets out of sync. | At the top of each hour.          |

**Example**

```sql theme={null}
-- Load assignments once a day
CALL management.set_task_schedule('log_load', '1 day')
```

## Configuration Properties

While certain components of the app are configurable directly via SQL (i.e., scaling a compute pool), other components may be configured indirectly.

### Properties

| Property                          | Description                                                                                                                                                                                                                                                                                                                               | Default |
| --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `PIPELINE:LOG_LOAD_DELAY_SECONDS` | How long (in seconds) to delay data loading. This is done to ensure that internal stages get caught up before loading data into a table. Snowflake doesn't offer an SLA for stage syncing, so this should be long enough to handle most cases. If it's too short, some data may not get picked up and will need to wait for the next run. | `30`    |

### Set configuration property

To set a property, execute the following procedure:

```sql theme={null}
CALL management.set_config_property('<property>', '<value>')
```

**Example**

```sql theme={null}
-- Reduce the assignment load delay to 10 seconds
CALL management.set_config_property('PIPELINE:LOG_LOAD_DELAY_SECONDS', '10')
```

<Note>
  All values are stored as strings. So even a number, such as `100` should be stored as `'100'`.
</Note>

### Get configuration properties

To see the current configuration properties, perform a `SELECT` from `management.config_properties`.

**Example**

```sql theme={null}
-- See all configuration properties
SELECT * FROM management.config_properties;
```
