Pause Warehouse Auto-Management with the API
Use the Warehouses API to pause Revefi auto-management of a Snowflake warehouse from your own pipelines and runbooks, and choose the size it is left at.
Revefi auto-management sizes a Snowflake warehouse on a schedule built from its usage patterns. Most of the time that is exactly what you want. But some moments are not typical: a one-off backfill, a production incident, a release freeze. In those moments teams want one thing: hold this warehouse still, at a size we choose, until we say otherwise.
The Pause Warehouse Auto-Management endpoint does that. One API call pauses auto-management of a warehouse and, optionally, sets the size it is left at. The warehouse keeps its schedule, so auto-management can be resumed later with a single call.
The Warehouses API is under private review. Its signatures may change without notice. Please talk to the Revefi support team at [email protected] before using it.
This page describes the problems data teams solve by pausing auto-management through the API. To turn auto-management back on, see Resume Warehouse Auto-Management with the API.
Who this is for
- Data platform and data engineering leads who own Snowflake warehouses and want auto-management to step aside during planned work.
- Analytics engineers and pipeline owners who run backfills, migrations, and month-end jobs from an orchestrator and want the pause to be a step in the pipeline.
- On-call engineers and SREs who need a quick, scriptable way to return a warehouse to a known configuration during an incident.
- Release managers who enforce change freezes and need every warehouse held at its current size.
- FinOps and cloud cost analysts who want pauses to be deliberate, visible, and short-lived.
How pausing works
Send a POST request to /warehouses/{warehouseName}/auto-manage/pause. The request body is optional and has a single field, warehouseSize, which decides the size the warehouse is left at.
warehouseSize.mode | Size the warehouse is left at | Other fields |
|---|---|---|
current | The size and cluster counts it has when paused. This is the default with no body | None. size and cluster counts are rejected |
original | The size and cluster counts it had before auto-management was enabled | None. size and cluster counts are rejected |
custom | The size you send, from X-SMALL to 6X-LARGE | size is required. minClusterCount and maxClusterCount are optional |
A few things to know before you automate it:
- One warehouse per call. There is no bulk pause. To pause several warehouses, make one request for each.
- The call is asynchronous. A
202response means the request was accepted. The change finishes in the background, so read the warehouse'sautoManageStatusto confirm it ispaused. - The size change is best effort. If the size cannot be applied, the warehouse is still paused and keeps its current size.
- Only managed warehouses can be paused. A warehouse that Revefi is not auto-managing returns
409.
A successful request returns:
{
"name": "ANALYTICS_WH",
"action": "pause",
"status": "accepted"
}The examples below use Python with the requests library and read the API token from a REVEFI_API_TOKEN environment variable. Each script is complete and runs on its own.
Pin a known size before a planned heavy workload
The problem
A backfill, a migration, or a month-end close puts a load on the warehouse that looks nothing like a normal day. The schedule Revefi built from typical usage may not fit it, and the team running the job wants a fixed, predictable amount of compute for its duration.
How the API helps
Pause with mode custom and send the exact size and cluster counts the job needs. Make the call the first step of the pipeline, so the warehouse is pinned before the heavy queries start.
import os
import requests
BASE_URL = "https://gateway.revefi.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['REVEFI_API_TOKEN']}"}
WAREHOUSE = "TRANSFORM_WH"
# Pause auto-management and pin the warehouse at a fixed size for the backfill.
body = {
"warehouseSize": {
"mode": "custom",
"size": "X-LARGE", # required for mode "custom"
"minClusterCount": 1, # optional, cannot exceed maxClusterCount
"maxClusterCount": 4, # optional
}
}
response = requests.post(
f"{BASE_URL}/warehouses/{WAREHOUSE}/auto-manage/pause",
headers=HEADERS,
json=body,
timeout=30,
)
response.raise_for_status()
print(response.json())
# {'name': 'TRANSFORM_WH', 'action': 'pause', 'status': 'accepted'}If you only care about the size, leave the cluster counts out. The warehouse keeps the minimum and maximum cluster counts it already has.
body = {
"warehouseSize": {
"mode": "custom",
"size": "2X-LARGE",
}
}size is case-insensitive and the separator is optional, so X-SMALL, x_small, and XSMALL are the same size.
Outcome
The heavy workload runs on compute the team chose, and the pause is part of the pipeline instead of a manual step someone has to remember.
If the same window repeats every week or month, Schedule Overrides lock in a size for a recurring window without pausing auto-management.
Rule out auto-management during an incident
The problem
Queries are slow or queuing and the on-call engineer needs to narrow down the cause quickly. Returning the warehouse to the configuration it had before auto-management removes one variable, but nobody remembers what that configuration was.
How the API helps
Pause with mode original. Revefi restores the size and cluster counts the warehouse had before auto-management was enabled, so there is nothing to look up. Do not send size or cluster counts with this mode; the request is rejected with 400 if you do.
import os
import requests
BASE_URL = "https://gateway.revefi.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['REVEFI_API_TOKEN']}"}
WAREHOUSE = "ANALYTICS_WH"
# Pause auto-management and restore the configuration from before it was enabled.
body = {
"warehouseSize": {
"mode": "original",
}
}
response = requests.post(
f"{BASE_URL}/warehouses/{WAREHOUSE}/auto-manage/pause",
headers=HEADERS,
json=body,
timeout=30,
)
if response.status_code == 202:
print(f"Pause accepted for {WAREHOUSE}. Restoring its original size.")
elif response.status_code == 409:
print(f"{WAREHOUSE} is not auto-managed, so there is nothing to pause.")
else:
response.raise_for_status()Outcome
The warehouse is back on its pre-Revefi configuration in one call. The team can compare behavior with and without auto-management and move on to the real cause.
Hold warehouses steady during a change freeze
The problem
During a release freeze, an audit window, or a peak business period, the rule is simple: nothing changes. That includes warehouse sizes, across every warehouse Revefi manages.
How the API helps
Pause with no request body. Each warehouse stays at the size it has at that moment. This is the same as sending mode current.
There is no bulk pause, so list the warehouses first and make one pause call for each managed warehouse.
import json
import os
import requests
BASE_URL = "https://gateway.revefi.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['REVEFI_API_TOKEN']}"}
# Find every warehouse Revefi is auto-managing right now.
response = requests.get(f"{BASE_URL}/warehouses", headers=HEADERS, timeout=30)
response.raise_for_status()
managed = [w["name"] for w in response.json() if w["autoManageStatus"] == "managed"]
# Pause them one at a time. No body, so each warehouse keeps its current size.
paused_by_freeze = []
for warehouse in managed:
response = requests.post(
f"{BASE_URL}/warehouses/{warehouse}/auto-manage/pause",
headers=HEADERS,
timeout=30,
)
if response.status_code == 202:
paused_by_freeze.append(warehouse)
print(f"{warehouse}: pause accepted")
else:
print(f"{warehouse}: not paused ({response.status_code}) {response.text}")
# Keep the list, so the same warehouses can be resumed when the freeze ends.
with open("paused_by_freeze.json", "w") as f:
json.dump(paused_by_freeze, f)If you prefer the request to state its intent, send the mode explicitly. The result is the same.
body = {
"warehouseSize": {
"mode": "current",
}
}To freeze only some warehouses, replace the managed list with the names you want.
Outcome
Every managed warehouse holds its size for the length of the freeze, and the team has a record of exactly which warehouses it paused.
Build automation that is safe to rerun
The problem
Pipelines retry and scripts get run twice. A pause step that fails on the second run, or reports success before the change has landed, creates more work than doing it by hand.
How the API helps
Three behaviors make the pause call easy to automate safely:
- Status is readable. Get a Warehouse by Name returns
autoManageStatus, so a script can skip a warehouse that is alreadypaused. - Errors are specific. Each status code points to a different action.
- The result can be confirmed. After a
202, pollautoManageStatusuntil it readspaused.
| Status | What it means | What to do |
|---|---|---|
202 | The pause was accepted | Poll autoManageStatus until it is paused |
400 | The body is invalid, or the account does not have exactly one Snowflake data source | Fix the request. Do not retry it unchanged |
403 | The token's user does not have edit access to this warehouse | Use a token whose user can edit the warehouse |
404 | No warehouse with this name exists | Check the name |
409 | The warehouse is not auto-managed | Nothing to pause. Treat as a skip |
429 | Too many requests | Wait, then retry |
503 | Access to the warehouse could not be verified. Nothing was changed | Wait, then retry |
The script below puts the three together.
import os
import time
import requests
BASE_URL = "https://gateway.revefi.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['REVEFI_API_TOKEN']}"}
RETRYABLE = {429, 503}
def get_status(warehouse):
"""Return the warehouse's autoManageStatus: managed, paused or not_managed."""
response = requests.get(
f"{BASE_URL}/warehouses/{warehouse}", headers=HEADERS, timeout=30
)
response.raise_for_status()
return response.json()[0]["autoManageStatus"]
def wait_for_status(warehouse, expected, timeout_seconds=300, interval_seconds=10):
"""Poll until the background change lands, or give up after the timeout."""
deadline = time.monotonic() + timeout_seconds
while time.monotonic() < deadline:
if get_status(warehouse) == expected:
return True
time.sleep(interval_seconds)
return False
def pause(warehouse, warehouse_size=None, attempts=3):
"""Pause auto-management of one warehouse. Safe to call more than once."""
status = get_status(warehouse)
if status == "paused":
print(f"{warehouse}: already paused, nothing to do")
return
if status == "not_managed":
print(f"{warehouse}: not auto-managed, nothing to pause")
return
# Leave the body out entirely to keep the current size.
body = {"warehouseSize": warehouse_size} if warehouse_size else None
for attempt in range(1, attempts + 1):
response = requests.post(
f"{BASE_URL}/warehouses/{warehouse}/auto-manage/pause",
headers=HEADERS,
json=body,
timeout=30,
)
if response.status_code == 202:
break
if response.status_code in RETRYABLE and attempt < attempts:
time.sleep(15 * attempt)
continue
raise RuntimeError(
f"{warehouse}: pause failed ({response.status_code}) {response.text}"
)
if wait_for_status(warehouse, "paused"):
print(f"{warehouse}: paused")
else:
raise TimeoutError(f"{warehouse}: pause accepted but not confirmed yet")
# Keep the current size.
pause("ANALYTICS_WH")
# Restore the size from before auto-management was enabled.
pause("REPORTING_WH", {"mode": "original"})
# Set a specific size and cluster counts.
pause(
"TRANSFORM_WH",
{"mode": "custom", "size": "LARGE", "minClusterCount": 1, "maxClusterCount": 3},
)autoManageStatus confirms the pause, not the size. Because the size change is best effort, check the warehouse in Snowflake if your job depends on the exact size.
Outcome
The pause step can be retried, rerun, and scheduled without side effects, and it reports success only when the warehouse is actually paused.
Get started
- Create an API token by following the steps in Public APIs. The token's user needs edit access to the warehouses you want to pause.
- Call Get Warehouses and pick the warehouses whose
autoManageStatusismanaged. - Decide the size each warehouse should be left at:
current,original, orcustom. See Warehouse Size Mode. - Call Pause Warehouse Auto-Management once for each warehouse.
- Read
autoManageStatusto confirm each warehouse ispaused. - When the work is done, resume auto-management.
Updated about 11 hours ago
