Repository navigation
Recover Dag processor work and expire inactive processors - #74791
Merged
ephraimbuddy merged 12 commits intoNov 6, 2026
Merged
Conversation
This was referenced Oct 15, 2026
ephraimbuddy
force-pushed
the
dag-processor-work-delivery
branch
from
October 16, 2026 15:35
912b141 to
8f1c3bf
Compare
ephraimbuddy
force-pushed
the
dag-processor-work-delivery
branch
from
October 16, 2026 16:59
8f1c3bf to
bf8149e
Compare
ephraimbuddy
force-pushed
the
dag-processor-work-delivery
branch
from
October 20, 2026 10:57
bf8149e to
6a8a0ee
Compare
ephraimbuddy
marked this pull request as ready for review
October 20, 2026 10:59
ephraimbuddy
requested review from
amoghrajesh,
ashb,
bugraoz93,
choo121600,
jason810496,
pierrejeambrun,
rawwar and
shubhamraj-git
as code owners
October 20, 2026 10:59
kaxil
reviewed
Oct 28, 2026
ephraimbuddy
force-pushed
the
dag-processor-work-delivery
branch
from
October 28, 2026 20:16
53dab83 to
1e44909
Compare
Contributor
|
The re-run of the jobs stopped by EC2 Spot interruptions finished: attempt 2 passed. |
ephraimbuddy
force-pushed
the
dag-processor-work-delivery
branch
from
October 29, 2026 16:55
1e44909 to
ed8e8b7
Compare
ephraimbuddy
force-pushed
the
dag-processor-work-delivery
branch
from
October 30, 2026 15:40
ed8e8b7 to
7b53ef6
Compare
kaxil
reviewed
Nov 4, 2026
kaxil
approved these changes
Nov 4, 2026
kaxil
left a comment
Member
There was a problem hiding this comment.
Thanks, the earlier points all look addressed. Two small nits inline, neither blocking.
ephraimbuddy
force-pushed
the
dag-processor-work-delivery
branch
from
November 5, 2026 11:44
7b53ef6 to
6eb02ca
Compare
ephraimbuddy
force-pushed
the
dag-processor-work-delivery
branch
from
November 5, 2026 13:11
6eb02ca to
2d075fe
Compare
Expose bounded, replayable claims for callback and priority parsing requests through the Execution API. Keep ownership until acknowledgment or processor retirement, and let the scheduler clean stale metadata in bounded batches.
Lost responses and reparses during an active import must not consume later requests. Callback replay must preserve priority, and routine cleanup must remain safe on SQLite and avoid scanning completed Job history.
Legacy Dags whose files were removed must become stale after a 2.x upgrade even when migration 0082 assigns a non-null bundle name. Existing files must remain active when bundle names or directories change.
The upstream migration sequence has advanced, so claim migrations and their regressions need the next available number. Claim receipts inherit Job cleanup through their foreign key and must retain replay protection while the Job remains alive.
Bundle discovery now returns source failure information alongside files. The upgrade regression must use the discovered files to exercise legacy Dag deactivation after migration 0082.
Inactive bundles must stop scheduling without waiting through multiple cleanup intervals, and expired owners must not retain parse checkpoints or leave callbacks outside normal database cleanup. Callback context needs a versioned response schema, while heartbeat thresholds must agree on when a processor can lose ownership. Regression coverage must exercise the configured database backend as well as replay, claim limits, inactive bundles, and interrupted cleanup.
Existing heartbeat settings must not prevent inactive bundles and retired processor metadata from being cleaned up when API expiration is unsafe. Distinct file paths must retain separate priority requests even when the database collation ignores case or accents, so requesting one file does not release another file's claim or lose the requested reparse.
Airflow's structlog bridge does not render stdlib `extra=` fields, so the warning logged when scheduler maintenance expired an API Dag processor Job carried only its message. Operators tracing a callback that ran twice could not tell which Job or host was expired, or which timeout applied. Maintenance also validated `job_heartbeat_timeout` on every run. That timeout only applies to API Dag processor Jobs, and database-mode deployments may legitimately set `[dag_processor] health_check_threshold` above it, so each scheduler logged a configuration warning every cleanup interval about an option the deployment never uses. The timeout is now checked only when a live API Dag processor Job exists, and a test keeps Job expiry batched, since nothing failed if that limit was dropped. Before maintenance moved to the scheduler, every Dag processor loop removed all warnings of stale Dags. Purging one batch per cleanup interval left warnings of a bulk-deactivated bundle listed in the Dag warnings API for many minutes, so they now drain in committed batches like the Dag and publication-receipt steps.
A Dag processor numbers callback and priority claims independently. If both kinds shared one claim record, a processor that had already claimed callbacks at a higher sequence would see every priority claim as stale, and priority reparses would never reach it. The claim body bounds cap how many rows one request can lock, and the route's Job check covers a Job that closes between token admission and the row lock. Nothing failed if any of these was removed. Some tests did not exercise this change. The takeover test passed without the new heartbeat-timeout validation, whose guard the registration test already covers, so it is dropped. The replaced legacy inventory test also passed without this change, so the original from the publication API change is restored. Tests of DagFileProcessorManager belong with the manager tests, SQLite-only tests should declare their backend instead of skipping themselves, and the lock-timeout test no longer names an inactive bundle it does not use.
The parsing_cleanup_interval description read as if every Dag processor Job is ended once it exceeds job_heartbeat_timeout. Only Jobs registered through the Execution API carry a session and are expired, so a database-mode operator could expect a hung processor to be ended when it never is. The stale Dag warning and publication receipt cleanups each capped their key batches at 499, but only one said why: each two-column key takes two bind parameters, and SQLite before 3.32 allows 999. Two copies of that bound could drift apart and break cleanup on older SQLite. The claim and acknowledgment routes took an untyped execution token, while the other Dag processor routes refuse any other token type before the handler runs. Main added migrations 0152 and 0153, so the work-claims migration is now 0155.
Main added migration 0154 and the publication-state migration below this one is now 0155, so the work-claims migration and its test move to 0156.
ephraimbuddy
force-pushed
the
dag-processor-work-delivery
branch
from
November 6, 2026 09:07
2d075fe to
99e077a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claim and acknowledge callbacks and priority parse requests through the Execution API, retaining them for recovery until acknowledged or their owner retires. Move inactive-bundle, warning, and expired-processor cleanup into bounded scheduler maintenance, and keep direct database consumers compatible with claimed work.
Layer 4 of the seven-part replacement for #74233, in GitHub native stack #74792. Depends on #74790. Base:
dag-processor-publication-api.GitHub's Files changed tab shows this layer. Compare this layer.
Merge order:
Focused SQLite tests: 410 passed, 11 backend-only skips. PostgreSQL: 330 passed. The priority-claim race regression failed before the locking fix; the final related reruns passed 13 PostgreSQL cases and 10 SQLite cases (3 backend-only skips). Regular/manual static checks and the complete 151-revision migration round trip passed.
Was generative AI tooling used to co-author this PR?
Generated-by: Codex (GPT-6) following the guidelines