Skip to content

backfill(ads): cancel ads_client_operations_and_errors_hourly_v1 backfill - #9834

Open
Almaju wants to merge 2 commits into
mainfrom
backfill/cancel-ads-client-hourly
Open

backfill(ads): cancel ads_client_operations_and_errors_hourly_v1 backfill#9834
Almaju wants to merge 2 commits into
mainfrom
backfill/cancel-ads-client-hourly

Conversation

@Almaju

@Almaju Almaju commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Description

Cancels the 2026-08-24 managed backfill entry for ads_derived.ads_client_operations_and_errors_hourly_v1 (status: InitiateCancelled) and records why in the entry's reason. Only backfill.yaml changes.

Why cancel instead of fix

The backfill failed with ValueError: Unable to parse parameter submission_date:DATE:{{ (execution_date - macros.timedelta(hours=1)).strftime('%Y-%m-%d') }}. Three independent reasons it can't run as configured:

  1. _parse_parameter in bigquery_etl/cli/query.py only accepts {{ds}} for DATE parameters. This table's hourly schedule binds submission_date off execution_date, so every date in the range raises, including the dry run.
  2. metadata.yaml has date_partition_parameter: null, so get_backfill_partition returns None — no $YYYYMMDD decorator. Each date would run bq query --replace against the whole staging table (16 in parallel), leaving one date's data.
  3. backfill complete would then raise Null partition found completing backfill (bigquery_etl/cli/backfill.py:1469).

The only supported route to the data would be reinitialize_table: true, which rebuilds every partition from the _stable tables — mobile back to 2026-02-01 — to recover ~2.5 weeks of thin desktop rows. Not worth it for a table still in development, so cancelling and accepting the gap: 2026-08-072026-08-23 stays empty for desktop, and the scheduled runs cover everything from here on.

There's also a deadline: CI runs bqetl backfill validate over every backfill.yaml on any SQL-touching PR, and validate_old_entry_date raises for an Initiate entry older than 28 days. From 2026-09-22 that job would fail repo-wide until this entry stops being Initiate.

What this does NOT do

  • Does not delete the staging table moz-fx-data-shared-prod.backfills_staging_derived.ads_derived__ads_client_operations_and_errors_hourly_v1_2026_08_24 — per docs/cookbooks/backfilling_a_table.md, a cancelled backfill's staging table is left to expire on its own (~30 days), not manually deleted. The Slack alert's delete instruction is for retrying, not cancelling.
  • Does not set status to Complete — nothing was staged, so there's nothing to swap into production.
  • Does not delete the entry or the file — the cancelled entry is the record.
  • Does not touch metadata.yaml, query.sql, or schema.yaml.
  • No BigQuery or Airflow changes.

Known follow-up (out of scope here)

The table is still unbackfillable. Fixing it means changing metadata.yaml scheduling: drop the templated parameters and destination_table, and let date_partition_parameter default to submission_date — the DAG generator then emits parameters=["submission_date:DATE:{{ds}}"] and lets the operator append $ds_nodash, so the bound date and destination partition always agree, including the hour-0 run. Side effect: a day's final recompute moves from 01:00 to 00:00 the next day, one hour less grace for late-arriving pings. Three other hourly tables (onboarding_hourly_v2, newtab_interactions_hourly_v1, newtab_content_reported_content_v1) have the same defect, so a framework fix to _parse_parameter may be preferred instead. Owner's call, separate PR.

Verification

  • bqetl backfill validate moz-fx-data-shared-prod.ads_derived.ads_client_operations_and_errors_hourly_v1 passes.
  • Confirmed via PyYAML: both entries parse, 2026-08-24 is Cancelled, 2026-04-01 is untouched at Complete, and no Initiate entry remains for this table.

Related Tickets & Documents

  • Bug 2058567

Reviewer, please follow this checklist

…fill

The 2026-08-24 entry cannot run. `bqetl query backfill` only parses
{{ds}} for DATE parameters, and this table's hourly schedule binds
submission_date off execution_date, so every date raises "Unable to
parse parameter". Behind that, date_partition_parameter is null, so
each date would overwrite the whole staging table and `backfill
complete` would fail on a null partition.

The only supported route is reinitialize_table, which rebuilds every
partition from the _stable tables (mobile back to 2026-02-01). That
scan is not worth it for a table still in development, so cancel the
entry: 2026-08-07 to 2026-08-23 stays empty for desktop and the
scheduled runs cover everything from here on.

Cancelling also clears the Initiate entry before it trips
validate_old_entry_date (28 days), which would fail the repo-wide
Validate Backfills job.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR flips the 2026-08-24 entry in ads_derived/ads_client_operations_and_errors_hourly_v1/backfill.yaml from Initiate to Cancelled and rewrites the entry's reason to record why; no other files change.

I checked the change against the tooling rather than only the description: Cancelled is a valid BackfillStatus, the entry still passes every check in validate_entries (entries stay sorted, the 2026-04-01 Complete entry is untouched, no remaining Initiate entry), and the requoted reason stays under the 160-char line-length limit in .yamllint.yaml. The stated blockers line up with metadata.yaml: date_partition_parameter: null plus a submission_date parameter templated off execution_date, which _parse_parameter in bigquery_etl/cli/query.py:488 rejects for DATE params, so the day-by-day path can't run and backfill complete would hit the null-partition check. Leaving the staging table to expire instead of deleting it matches docs/cookbooks/backfilling_a_table.md:432. The one documented alternative to reinitialize_table for a null date_partition_parameter (custom_query_path + override_depends_on_past_null_partition: true) would still fail on the same templated parameter, so the recorded rationale holds.

One checklist item: the PR references bug 2058567, so per .github/reviewer_checklist.md the bug number belongs in the PR title.

Comment on lines +4 to +12
reason: 'Backfill desktop''s ads_client history now that Firefox desktop is a source
(bug 2058567). Cancelled: this table cannot be replayed day-by-day - the hourly
schedule binds submission_date off execution_date, which `bqetl query backfill`
cannot parse, and date_partition_parameter is null, so `backfill complete` would
fail on a null partition. The only supported route is reinitialize_table, which
rebuilds every partition from the _stable tables (including mobile from 2026-02-01),
and that is not worth the scan while the table is still in development. Desktop
data flows in from the scheduled runs; 2026-08-07 to 2026-08-23 is intentionally
left empty.'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: The permanent desktop gap (2026-08-072026-08-23) is recorded only in a cancelled backfill.yaml entry, which isn't surfaced anywhere a consumer of the table looks. Anyone charting surface/desktop volumes over August will read the empty window as a real drop. Add a line to description in metadata.yaml (it propagates to the BigQuery table description and the data catalog), e.g. "Desktop rows are absent for 2026-08-07 through 2026-08-23; the backfill for that window was cancelled (bug 2058567)."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done: 22ce394

@scholtzan

This comment has been minimized.

…escription

The cancelled backfill.yaml entry isn't visible to anyone reading the
table itself (Looker, Redash, Data Catalog), so an empty
surface = 'Desktop' window in August reads as a real drop rather than
a known, deliberate gap. metadata.yaml's description is written to the
table's BigQuery description on deploy, so note it there.

Scoped to the fact this PR is responsible for (the cancelled-backfill
gap) rather than asserting current freshness, which is a separate,
moving concern.
@scholtzan

Copy link
Copy Markdown
Collaborator

Integration report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants