Loading...
Loading...
Optimize BigQuery compute costs by assigning data models (Dataform, dbt, Airflow) to slot reservations or on-demand compute based on Masthead recommendations.
npx skill4agent add masthead-data/for-agents optimize-data-model-computeinsightsmasthead-prod.YOUR_DATASET.insights.github/copilot-instructions.mdAGENTS.md<!-- masthead -->
MASTHEAD_DATASET=YOUR_DATASET
<!-- /masthead -->bq query --project_id=YOUR_PROJECT --use_legacy_sql=false --format=csv \
"SELECT subtype, COUNT(*) AS recommendation_count
FROM \`masthead-prod.YOUR_DATASET.insights\`
WHERE category = 'Cost'
AND type = 'Compute costs'
GROUP BY subtype"dbt_project.ymldefinitions/masthead-prod.YOUR_DATASET.insightsbq query --project_id=YOUR_PROJECT --use_legacy_sql=false --format=csv \
"SELECT
action_name,
recommended_model,
cost_30d,
last_updated_time
FROM \`masthead-prod.YOUR_DATASET.insights\`
WHERE category = 'Cost'
AND type = 'Compute costs'
AND subtype = ...
ORDER BY cost_30d DESC" > compute_assignment_candidates.csvmasthead-prod.YOUR_DATASET.insightsbq query --project_id=YOUR_PROJECT --use_legacy_sql=false --format=csv \
"SELECT
action_name,
recommended_model,
cost_30d,
last_updated_time
FROM \`masthead-prod.YOUR_DATASET.insights\`
WHERE category = 'Cost'
AND type = 'Compute costs'
AND subtype = ...
ORDER BY cost_30d DESC" > compute_assignment_candidates.csvrecommended_modelINFORMATION_SCHEMA.RESERVATIONSbq query --project_id=RESERVATION_ADMIN_PROJECT --location=US --use_legacy_sql=false --format=csv \
"SELECT
reservation_name,
project_id,
edition,
slot_capacity
FROM \`region-us\`.INFORMATION_SCHEMA.RESERVATIONS
ORDER BY project_id, reservation_name"recommended_model = 'ON_DEMAND'reservation = 'none'ENTERPRISErecommended_model{
tag: 'on_demand',
reservation: 'none',
actions: []
}bq query --project_id=YOUR_PROJECT --use_legacy_sql=false --format=csv \
"SELECT
action_name,
recommended_model
FROM \`masthead-prod.YOUR_DATASET.insights\`
WHERE category = 'Cost'
AND type = 'Compute costs'
AND subtype = ...
ORDER BY cost_30d DESC" > compute_assignment_final.csvdefinitions/_reservations.json_demandactionsrecommended_model = 'ON_DEMAND'actionsrecommended_model != 'ON_DEMAND'dataform compile@masthead-data/dataform-packagemasthead-data/dbt-reservationsdbt_project.ymlmasthead-data/airflow-reservations# Check syntax
dataform compile
# Validate no duplicate assignments
grep -r "\.actions" definitions/_reservations.js| Factor | Reserved Slots | On-Demand |
|---|---|---|
| Priority | High, SLA-bound | Low, flexible |
| Frequency | Regular, scheduled | Ad-hoc, occasional |
| Cost Pattern | Predictable usage | Variable, sporadic |
| Impact | Critical pipelines | Experimental, samples |
_@masthead-data/dataform-packagemasthead-data/dbt-reservationsmasthead-data/airflow-reservations