Skip to content

Fix Dag serialization crash for Task SDK EventsTimetable - #69401

Open
anxkhn wants to merge 1 commit into
apache:mainfrom
anxkhn:patch-3
Open

anxkhn wants to merge 1 commit into
apache:mainfrom
anxkhn:patch-3

Conversation

@anxkhn

@anxkhn anxkhn commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Any Dag scheduled with the Task SDK EventsTimetable
(from airflow.sdk import EventsTimetable) currently fails to serialize with
SerializationError: Failed to serialize DAG '...': '_summary', so the Dag
cannot be parsed or scheduled.

The SDK timetable serializer in airflow-core/src/airflow/serialization/encoders.py
emits only {event_dates, restrict_to_events, description} and omits the
_summary key, but the core EventsTimetable.deserialize in
airflow-core/src/airflow/timetables/events.py read data["_summary"]
unconditionally and raised KeyError when it was absent. The two are
asymmetric: _summary became a required serialized field in #51203, and the
SDK serializer that omits it was added in #58669.

This makes deserialize retain the summary already computed by
EventsTimetable.__init__ when _summary is absent. Dags using the SDK
timetable serialize and schedule again, while existing serialized data that
still carries _summary keeps its stored value. The deserialize-side fix also
recovers serialized Dag rows already written without _summary.

A parametrized regression test round-trips a Dag scheduled with the SDK
EventsTimetable through DagSerialization with and without a description
and asserts the summary is preserved.


Was generative AI tooling used to co-author this PR?
  • Yes, OpenCode (GPT-5.6)

Generated-by: OpenCode (GPT-5.6) following the guidelines

@Vamsi-klu

This comment was marked as spam.

@anxkhn
anxkhn force-pushed the patch-3 branch 2 times, most recently from b40dbbe to caee4b7 Compare July 16, 2026 06:04
@potiuk potiuk added the ready for maintainer review Set by triage when all criteria pass, or by the fork CI reconciler when fork CI is green. label Jul 18, 2026
@anxkhn

anxkhn commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

@Lee-W the requested deserialization handling has been revised and the checks are green. could you review this when convenient?

A Dag scheduled with the Task SDK EventsTimetable failed to serialize
because the SDK timetable serializer omits the _summary key, while the
core EventsTimetable.deserialize required it unconditionally and raised
KeyError. Fall back to the summary computed by __init__ when the key is
absent, so Dags using the SDK timetable serialize and schedule again
while existing serialized data keeps its stored summary.

Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
@anxkhn

anxkhn commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

@uranusjr, could you review this PR again? It has been open for 75 days and is freshly rebased with the requested change applied.


Drafted-by: OpenCode (GPT-5.6) (no human review before posting)

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

area:dag-processor ready for maintainer review Set by triage when all criteria pass, or by the fork CI reconciler when fork CI is green.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants