Skip to content

feat(web-analytics): add dedicated eager backfill job with 24h budget - #70592

Merged
lricoy merged 4 commits into
masterfrom
lricoy/wa-eager-backfill-job
Jul 14, 2026
Merged

feat(web-analytics): add dedicated eager backfill job with 24h budget#70592
lricoy merged 4 commits into
masterfrom
lricoy/wa-eager-backfill-job

Conversation

@lricoy

@lricoy lricoy commented Jul 13, 2026

Copy link
Copy Markdown
Member

Problem

#70544 added active_teams_pct to the eager warmer's run config, but the warm job's 90-minute max_runtime is sized for hourly maintenance, not a fleet backfill: the op warms teams through a fixed 10-worker pool, so a bigger audience doesn't raise instantaneous cluster load - it only runs longer. A 100% backfill (~9k active teams, ~1.2M window inserts at the measured ~27k/h ceiling) needs ~40+ hours, which the maintenance job can only grind through in truncated 90-minute slices.

Changes

New manual-only Dagster job web_analytics_eager_backfill, reusing the existing warm op unchanged:

  • Default run config bakes in active_teams_pct: 100 - launch with no config for a full-fleet backfill, or override the pct for a partial one.
  • dagster/max_runtime of 24h instead of 90min. Fully resumable: windows built before a termination persist via their TTLs, so a relaunch skips them and continues the tail.
  • Safe to run alongside the hourly schedule: the scheduled job is untouched, and the pending-job unique index dedupes any window both touch.
  • Same 10-worker concurrency cap, so the offline tier sees the already-measured load profile (5% ramp: ~27k inserts/h, 0 failures, no visible load delta on aux or offline CPU), just for longer.

How did you test this code?

  • Job definition reuses the tested op and config; registration mirrors the existing jobs list. The 5% ramp run in prod validated the underlying op + config path end to end (zero failures over 1h+ of sustained cold pass).

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Authored with Claude Code. Lucas observed the fixed-concurrency property during the live 5% ramp (bigger audience = longer runtime, not more pressure) and asked for a backfill-specific job rather than raising the schedule's percentage. Originally committed to the #70544 branch, which had already merged - cherry-picked to this fresh branch.

@lricoy lricoy self-assigned this Jul 13, 2026
@lricoy
lricoy marked this pull request as ready for review July 13, 2026 23:12
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team July 13, 2026 23:13
@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "feat(web-analytics): add dedicated eager..." | Re-trigger Greptile

Comment thread products/web_analytics/dags/eager_web_analytics_precompute.py Outdated
Comment thread products/web_analytics/dags/eager_web_analytics_precompute.py
@trunk-io

trunk-io Bot commented Jul 13, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8c70ed66af

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread products/web_analytics/dags/eager_web_analytics_precompute.py
@lricoy lricoy added the stamphog Request AI approval (no full review) label Jul 13, 2026
stamphog[bot]
stamphog Bot previously approved these changes Jul 13, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Manual-only Dagster backfill job reusing a well-tested op; the two substantive greptile/codex concerns (global setting leak, unresumable audience across chunks, run overlap) were each fixed in the current head with a try/finally restore, a job-level concurrency guard, and a widened lookback window, and greptile reacted 👍 to the fix replies. Author owns the file and has STRONG familiarity (100% of touched lines, 38 merged PRs in this path), which covers assurance for this non-schema, non-API, non-auth internal tooling change.

  • Author wrote 100% of the modified lines and has 38 merged PRs in these paths (familiarity STRONG).
  • 👍 on the PR from greptile-apps[bot], hex-security-app[bot].
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 348L, 2F substantive — within ceiling
tier T1-agent / T1d-complex (348L, 2F, two-areas, feat)
stamphog 2.0.0b3 .stamphog/policy.yml @ ce5a82c · reviewed head a20353f

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Playwright — 1 failed

🎭 Playwright report · View test results →

1 failed test:

  • password-protected insight sharing (chromium)

These issues are not necessarily caused by your changes.
Annoyed by this section? Help fix flakies and failures and it will go green!

@stamphog
stamphog Bot dismissed their stale review July 14, 2026 00:01

New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.

@lricoy
lricoy enabled auto-merge (squash) July 14, 2026 00:02
Comment on lines +660 to +664
older = [
r
for r in in_flight
if r.dagster_run.run_id != context.run_id and (ours is None or r.create_timestamp <= ours.create_timestamp)
]

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.

Race condition in concurrent run detection. If two runs are launched simultaneously and receive identical create_timestamp values, both will see each other as "older" (due to the <= comparison) and both will fail, preventing any backfill from proceeding.

# Should use strict < instead of <=
older = [
    r
    for r in in_flight
    if r.dagster_run.run_id != context.run_id and (ours is None or r.create_timestamp < ours.create_timestamp)
]

With strict <, equal timestamps mean neither run is strictly older, so only genuinely older runs will trigger the failure.

Suggested change
older = [
r
for r in in_flight
if r.dagster_run.run_id != context.run_id and (ours is None or r.create_timestamp <= ours.create_timestamp)
]
older = [
r
for r in in_flight
if r.dagster_run.run_id != context.run_id and (ours is None or r.create_timestamp < ours.create_timestamp)
]

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Contained addition of a manual-only backfill Dagster job reusing the existing warm op; the flagged greptile/codex concerns (global-setting leak, concurrent-run overlap, audience drift across chunks) were all fixed and marked resolved with bot thumbs-up, and the reported trunk-io test failures match the job_name access pattern this diff's try/except already guards against. Author is on the owning team with STRONG familiarity.

  • Author wrote 100% of the modified lines and has 38 merged PRs in these paths (familiarity STRONG).
  • 👍 on the PR from greptile-apps[bot], hex-security-app[bot].
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 354L, 2F substantive — within ceiling
tier T1-agent / T1d-complex (354L, 2F, two-areas, feat)
stamphog 2.0.0b3 .stamphog/policy.yml @ f93c4d0 · reviewed head 322b308

@lricoy
lricoy merged commit be1ac16 into master Jul 14, 2026
240 checks passed
@lricoy
lricoy deleted the lricoy/wa-eager-backfill-job branch July 14, 2026 00:20
@deployment-status-posthog

deployment-status-posthog Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-07-14 02:24 UTC Run
prod-us ✅ Deployed 2026-07-14 02:36 UTC Run
prod-eu ✅ Deployed 2026-07-14 02:36 UTC Run

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

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant