Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(signals): give the inbox ranking dataset job 24Gi and train at 05:00 utc (#113061)

posthog[bot]b13593cadb15
diff --git a/products/signals/dags/inbox_ranking/README.md b/products/signals/dags/inbox_ranking/README.md
index 022e3d260ed3..82ea1f0cc583 100644
--- a/products/signals/dags/inbox_ranking/README.md
+++ b/products/signals/dags/inbox_ranking/README.md
@@ -69,7 +69,7 @@ The first four are report grain and land in one table. `inbox_signal_embeddings`
## The training dag
-`inbox_ranking_training_job` runs daily at 06:13 UTC on the same partition definition (gated like the dataset job) and writes:
+`inbox_ranking_training_job` runs daily at 05:00 UTC on the same partition definition (gated like the dataset job) and writes:
```text
s3://<bucket>/<prefix>/
@@ -311,7 +311,7 @@ All reads route to the offline cluster replicas on Cloud (`etl_workload()`), car
- A label column change needs a `FEATURE_SCHEMA_VERSION` bump, and no manual backfill. The labels asset stamps the version in each object's `feature-schema-version` metadata. Every hour, `inbox_ranking_labels_refresh_sensor` finds labels partitions in the training lookback whose stamp is missing or older, and runs `inbox_ranking_labels_refresh_job` on at most `INBOX_RANKING_LABELS_REFRESH_MAX_RUNS` (default 6) of them, newest first. A 60-day lookback is current again in about 10 hours. The sensor skips the newest day, which the daily schedule writes, and partitions with no labels object. It requests a partition at most once per schema version, so a failed refresh alerts and needs a person. The refresh covers labels only: report state reads current Postgres and embeddings have a TTL, so a rewrite of those is not point-in-time. `pairs_skipped_missing_label_columns` on `inbox_ranking_examples_built` counts the snapshot pairs each head lost to a missing label column while partitions are stale.
- Do not materialize these assets in-process in the code-location pod. Its memory limit (2Gi) is too small; launch a run instead.
- Failures alert `#alerts-self-driving` (owner `team-self-driving`); assets retry twice with a 60s delay before failing a run. A UI-launched materialization runs under Dagster's implicit `__ASSET_JOB`, which carries no owner tag, so alert routing falls back to matching the `inbox_report_`, `inbox_signal_`, and `inbox_ranking_` asset-name prefixes.
-- Runtime budgets are per job (`dagster/max_runtime`): 3h for the dataset and training jobs, 1h for the shadow job. The 3h figure is what the dataset needs — its seven label streams run sequentially, each allowed up to 600s, and the join and S3 writes come after them. The shadow read is one day of two event families plus the scores objects in its lookback, so it gets an hour.
+- Runtime budgets are per job (`dagster/max_runtime`): 2h for the dataset job, 3h for the training job, 1h for the shadow job. The dataset needs the 2h: its seven label streams run sequentially, each allowed up to 600s, and the join and S3 writes come after them. The dataset cap ends before training starts at 05:00 UTC, so a stuck dataset run fails before training reads its snapshots. The shadow read is one day of two event families plus the scores objects in its lookback, so it gets an hour.
## Training consent
diff --git a/products/signals/dags/inbox_ranking/dataset/dag.py b/products/signals/dags/inbox_ranking/dataset/dag.py
index 1eca4970fb0b..8fefae593e1a 100644
--- a/products/signals/dags/inbox_ranking/dataset/dag.py
+++ b/products/signals/dags/inbox_ranking/dataset/dag.py
@@ -1055,10 +1055,11 @@ inbox_ranking_dataset_job = dagster.define_asset_job(
],
# The seven label streams run sequentially and each may take its full 600s query timeout, so an
# hour left a slow-but-valid pass no room for the join, the S3 writes, or an asset retry — and
- # the label windows only grow, since they accumulate from LABELS_EPOCH.
+ # the label windows only grow, since they accumulate from LABELS_EPOCH. The cap must end before
+ # the training schedule starts, so a stuck run fails instead of leaving training without snapshots.
tags={
**owner_tags,
- "dagster/max_runtime": str(3 * 60 * 60),
+ "dagster/max_runtime": str(2 * 60 * 60),
# The state, embeddings, signal-embeddings and labels assets execute as parallel subprocesses
# in one run pod, and the embeddings snapshot holds a 1536-float vector per live report, so
# the pod's peak memory grows with the inventory. The default 8Gi limit is what a run gets
@@ -1067,7 +1068,7 @@ inbox_ranking_dataset_job = dagster.define_asset_job(
"container_config": {
"resources": {
"requests": {"memory": "8Gi"},
- "limits": {"memory": "16Gi"},
+ "limits": {"memory": "24Gi"},
}
}
},
diff --git a/products/signals/dags/inbox_ranking/training/dag.py b/products/signals/dags/inbox_ranking/training/dag.py
index a4e78ec6f6a0..db795c10f5f8 100644
--- a/products/signals/dags/inbox_ranking/training/dag.py
+++ b/products/signals/dags/inbox_ranking/training/dag.py
@@ -1469,15 +1469,14 @@ inbox_ranking_training_job = dagster.define_asset_job(
**owner_tags,
# The report-embeddings family fits 1536-column heads, and each head costs a fit per
# permutation draw on top of the two it ships, so the wall clock is now the trainer's
- # rather than the ETL's. Matched to the dataset job's budget.
+ # rather than the ETL's.
"dagster/max_runtime": str(3 * 60 * 60),
# The examples asset holds every snapshot of the lookback window in pandas at once (state
# plus labels per day) before the per-head builders run, plus one rendering's vectors as
# the side input the embedding set being built reads, so the peak grows with the lookback
# and the inventory. It is one rendering at a time rather than one per family, so a further
- # embedding family costs runtime and not peak. The limit sits above the dataset job's
- # because that vector table is only one of the things held here; growth should surface as a
- # slow run, not an OOMKilled pod.
+ # embedding family costs runtime and not peak. Growth should surface as a slow run, not an
+ # OOMKilled pod.
"dagster-k8s/config": {
"container_config": {
"resources": {
@@ -1490,9 +1489,9 @@ inbox_ranking_training_job = dagster.define_asset_job(
)
-# Runs after the dataset job's 3h budget (02:30 UTC start) so dt=D-1's snapshots exist.
+# Runs after the dataset job's 2h budget (02:30 UTC start) so dt=D-1's snapshots exist.
@dagster.schedule(
- cron_schedule="13 6 * * *",
+ cron_schedule="0 5 * * *",
job=inbox_ranking_training_job,
execution_timezone="UTC",
default_status=dagster.DefaultScheduleStatus.RUNNING