Repository navigation
fix(cost): sync on the cheapest warehouse and finish runs before collecting costs - #1576
Merged
Merged
Conversation
…house A location's warehouse syncs ran under no command group, so they used the connection's warehouse, often the largest, to read metadata and small state tables, waking it for a minimum billed minute each time. The location command now uses a new 'sync' warehouse group: the target's [targets.<name>.warehouses] sync, else query, else the connection's own warehouse, as before. The target's build warehouse is used only when the connection names none, so a sync can still run. sqb debug lists the sync warehouse with where it comes from, and the location reports it when a sync session opens. Runs a location executes keep their own command's group.
… edge The conversions between CostRunRecord objects and plain cost runs call into Python, so they move from the bindings crate to sqlbuild-python-front's resource_costs area, a configured Python edge, next to the resource costs table they feed. Behaviour is unchanged. The bindings crate drops below its code-line cap again, and the two pending edge budgets for the old file go away.
…ange Run-end cost collection kept builds and server runs open for 30-50 s and re-read the same runs on every build without changing them. - A finished query still without a warehouse size two minutes after it ended ran without warehouse compute (for example a result Snowflake served from metadata); it no longer marks the run partial. A newer one is still missing metadata, which a later build's re-read settles. - A partial run is re-read only while a statement was unseen, still running or awaiting metadata; a run that saw every statement with only permanent limitations is final. Runs are re-read only once they ended two minutes ago. - An older run's re-read reads only its own window instead of every query since it started, and re-reads share an 8 s budget per build. - The run-end sweep does not retry for missing metadata alone, and a command-line build's sweep has a 6 s budget. - A command-line build prints its summary, then 'Collecting warehouse costs...'. A worker build records its cost pending and collects it after the run publishes its outcome, so the run finishes and releases its claims first.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A location's warehouse syncs ran under no command group, so they could wake a large warehouse just to read metadata and small state tables, paying a minimum billed minute each time. Run-end cost collection also kept builds and server runs open for 30 to 50 s, and every build re-read older runs whose costs could not change.
Changes
syncwarehouse group: the target'ssyncwarehouse, elsequery, else the connection's own warehouse, as before. The target'sbuildwarehouse is used only when the connection names none, so a sync can still run. This deliberately differs from the earlier local commit, which triedbuildbefore the connection's warehouse.sqb debuglists the sync warehouse and its source. Runs a location executes keep their own command's group.Collecting warehouse costs..., with a 6 s run-end budget. A worker build records its cost as pending and collects it after the run publishes its outcome.Verification
sync, thenquery, then the connection's warehouse; a target with onlybuild = "XL_WH"and a connection warehouse syncs on the connection's (fails on the earlier order); with no connection warehouse it usesbuild.sqlbuild-state) and Snowflake cost unit tests: missing metadata, final partial runs, per-run windows, shared budget.make check-cipassed on the final head.