fix(scheduler): skip asset-triggered dags without SerializedDagModel#64322
Open
leossantos wants to merge 3 commits intoapache:mainfrom
Open
fix(scheduler): skip asset-triggered dags without SerializedDagModel#64322leossantos wants to merge 3 commits intoapache:mainfrom
leossantos wants to merge 3 commits intoapache:mainfrom
Conversation
1 task
…in dags_needing_dagruns Remove those dag_ids from the in-memory candidate set until serialization exists; retain AssetDagRunQueue rows and emit DEBUG logs. Add unit tests and a bugfix newsfragment.
…izedDagModel is unavailable
Split DagModel and AssetDagRunQueue inserts and flush after DagModel so foreign-key order matches production DB constraints in TestDagModel.
0b227b5 to
38a59e0
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.
Port to main (Airflow 3) of the scheduler guard from #63546:
DagModel.dags_needing_dagrunscould treat asset-triggered DAGs as ready for a new run when they hadAssetDagRunQueuerows but noSerializedDagModelin the same evaluation window. The asset timetable / condition path was not applied consistently for those DAGs, which could allow premature asset-triggered DagRuns while the DAG processor was mid–parse cycle.This change removes such
dag_ids from the in-memoryadrq_by_dag/dag_statusesmaps until serialization exists.AssetDagRunQueuerows are not deleted; the scheduler can re-evaluate on a later run. A DEBUG log records skipped DAGs (missing serialization). Thedags_needing_dagrunsdocstring documents this behavior.Tests: two
TestDagModelcases cover missingSerializedDagModel(single and multiple DAGs), DEBUG log expectations, sorteddag_idlist in the message, and assertasset_dag_run_queuerow counts unchanged afterdags_needing_dagruns.related: #63546
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.