FOCUS dataset
FOCUS is a Google Cloud feature that exports the project’s cloud cost data to a BigQuery table. GENI Workflows reads that table to attribute cost to submissions, tasks and the rest.
Google’s setup guide: Set up FOCUS billing export to BigQuery.
What you need afterwards
Section titled “What you need afterwards”Two values, both passed when creating the environment:
| Value | Example |
|---|---|
Table identifier, project.dataset.table |
useful-loop-496215-i8.gcp_billing_immutable_01F464_AC8B27_889258_us.gcp_billing_export_focus_01F464_AC8B27_889258 |
| Table location | us |
Read both values from the CLI
Section titled “Read both values from the CLI”bq ships with the gcloud CLI, so no extra install is needed. Sign in to the project that
holds the export:
gcloud auth loginexport PROJECT_ID=<project-id>1. Find the dataset. The FOCUS export lives in a dataset named gcp_billing_immutable_…,
suffixed with the billing account ID and the region:
bq ls --project_id=$PROJECT_ID --datasets --max_results=100 datasetId ------------------------------------------------- gcp_billing_immutable_01F464_AC8B27_889258_us2. Find the table inside it. The FOCUS table is the one named gcp_billing_export_focus_….
A dataset often also holds gcp_billing_export_v1_… and gcp_billing_export_resource_v1_… —
those are the older non-FOCUS exports and will not work:
export DATASET_ID=gcp_billing_immutable_01F464_AC8B27_889258_usbq ls --project_id=$PROJECT_ID --max_results=100 "$PROJECT_ID:$DATASET_ID" tableId Type ---------------------------------------- ------- gcp_billing_export_focus_01F464_AC8B27_889258 TABLE3. Read the location. This is the --focus-location value:
bq show --project_id=$PROJECT_ID --format=prettyjson "$PROJECT_ID:$DATASET_ID" \ | grep '"location"'Print both values ready to paste
Section titled “Print both values ready to paste”With PROJECT_ID set, this finds the dataset and table for you and prints the two arguments:
DATASET_ID=$(bq ls --project_id=$PROJECT_ID --datasets --max_results=100 \ | grep -o 'gcp_billing_immutable_[A-Za-z0-9_]*' | head -1)
TABLE_ID=$(bq ls --project_id=$PROJECT_ID --max_results=100 "$PROJECT_ID:$DATASET_ID" \ | grep -o 'gcp_billing_export_focus_[A-Za-z0-9_]*' | head -1)
LOCATION=$(bq show --project_id=$PROJECT_ID --format=prettyjson "$PROJECT_ID:$DATASET_ID" \ | grep '"location"' | cut -d'"' -f4)
echo "--focus-dataset $PROJECT_ID.$DATASET_ID.$TABLE_ID"echo "--focus-location $LOCATION"If DATASET_ID or TABLE_ID comes back empty, the export is not set up yet — follow
Google’s setup guide linked above and wait for the first table to appear. A newly created
export takes a few hours to publish its first rows.
Enable it on an existing environment
Section titled “Enable it on an existing environment”Pass the environment ID (from geni environment list) followed by both values:
geni environment update <environment-id> \ --focus-dataset <project.dataset.table> \ --focus-location <focus-region>For example:
geni environment update 8f0de10b-8cc7-48dc-ad16-74a295d3bb46 \ --focus-dataset useful-loop-496215-i8.gcp_billing_immutable_01F464_AC8B27_889258_us.gcp_billing_export_focus_01F464_AC8B27_889258 \ --focus-location usThe environment moves to UPDATING while the change is applied. --focus-location requires
--focus-dataset; running the command again with another table replaces the previous one.
Cost data appears after the next daily cost sync, so allow a day before checking
geni costs submission. If it stays empty, the usual cause is a --focus-dataset that was
missing the table name.