Skip to content

Fix deadline pruning crash when dag.deadline holds serialized alerts - #73430

Open
wislertt wants to merge 1 commit into
apache:mainfrom
wislertt:fix/dag-test-deadline-serialized-alerts
Open

wislertt wants to merge 1 commit into
apache:mainfrom
wislertt:fix/dag-test-deadline-serialized-alerts

Conversation

@wislertt

Copy link
Copy Markdown

Why

airflow dags test exits non-zero for any DAG that sets a deadline, even though the run succeeded. DAG.test() builds its scheduler DAG with an in-memory serialize/deserialize round trip, which leaves dag.deadline holding encoded deadline alerts instead of deadline_alert ids. When the run succeeds, DagRun.update_state() passes those dicts to DeadlineAlertModel.get_by_id(), which fails in the Uuid bind processor with 'dict' object has no attribute 'hex'.

What

Dict entries in dag.deadline are decoded directly instead of looked up in the deadline_alert table. Entries that are strings keep the existing get_by_id() path used by the scheduler.

closes: #73428


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code following the guidelines

DagRun.update_state() assumed every entry in dag.deadline is a
deadline_alert id, but DAG.test() builds its scheduler DAG with an
in-memory serialize/deserialize round trip, which leaves the entries
as encoded deadline alerts. Passing those dicts to
DeadlineAlertModel.get_by_id() fails in the Uuid bind processor with
'dict' object has no attribute 'hex', so 'airflow dags test' exits
non-zero for any DAG with a deadline, even though the run succeeded.

Decode dict entries directly instead of looking them up in the
deadline_alert table. Entries that are strings keep the existing
get_by_id() path used by the scheduler.

Fixes apache#73428

Co-Authored-By: Claude Code <noreply@anthropic.com>
@boring-cyborg

boring-cyborg Bot commented Sep 21, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

This branch has not been deployed

No deployments
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.

airflow dags test fails with AttributeError: 'dict' object has no attribute 'hex' for DAGs with deadline

1 participant