This is an automated email from the ASF dual-hosted git repository.

vatsrahul1001 pushed a commit to branch v3-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-4-test by this push:
     new 3c71d816a03 [v3-4-test] Fix serialization of Dags scheduled with the 
Task SDK EventsTimetable (#77616) (#77674)
3c71d816a03 is described below

commit 3c71d816a0366b2354a03d0890492211e5b74b50
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Nov 30 14:03:31 2026 +0000

    [v3-4-test] Fix serialization of Dags scheduled with the Task SDK 
EventsTimetable (#77616) (#77674)
    
    (cherry picked from commit 699de72fe30daad94e4b9a34a6dd4bd44ba6156c)
    
    Co-authored-by: Adam Postek <[email protected]>
---
 airflow-core/src/airflow/timetables/events.py      |  5 +++-
 .../tests/unit/timetables/test_events_timetable.py | 32 ++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/airflow-core/src/airflow/timetables/events.py 
b/airflow-core/src/airflow/timetables/events.py
index 9fedc476c1c..ef6ce5176a2 100644
--- a/airflow-core/src/airflow/timetables/events.py
+++ b/airflow-core/src/airflow/timetables/events.py
@@ -16,6 +16,7 @@
 # under the License.
 from __future__ import annotations
 
+import contextlib
 import itertools
 from typing import TYPE_CHECKING, Any
 
@@ -137,5 +138,7 @@ class EventsTimetable(Timetable):
             presorted=True,
             description=data["description"],
         )
-        timetable._summary = data["_summary"]
+        # The Task SDK encoder does not emit _summary; keep the one computed 
from description.
+        with contextlib.suppress(KeyError):
+            timetable._summary = data["_summary"]
         return timetable
diff --git a/airflow-core/tests/unit/timetables/test_events_timetable.py 
b/airflow-core/tests/unit/timetables/test_events_timetable.py
index 80166b57389..d348ad5608e 100644
--- a/airflow-core/tests/unit/timetables/test_events_timetable.py
+++ b/airflow-core/tests/unit/timetables/test_events_timetable.py
@@ -22,6 +22,9 @@ import pytest
 import time_machine
 
 from airflow._shared.timezones.timezone import utc
+from airflow.sdk import EventsTimetable as SdkEventsTimetable
+from airflow.serialization.decoders import decode_timetable
+from airflow.serialization.encoders import encode_timetable
 from airflow.timetables.base import DagRunInfo, DataInterval, TimeRestriction, 
Timetable
 from airflow.timetables.events import EventsTimetable
 
@@ -222,3 +225,32 @@ def 
test_timetable_without_description_after_serialization_is_the_same():
     assert deserialized.summary == summary
     assert deserialized.description == description
     assert deserialized.event_dates == EVENT_DATES
+
+
[email protected](
+    ("kwargs", "expected_summary", "expected_description"),
+    [
+        pytest.param(
+            {},
+            "5 events",
+            "5 events between 2021-09-06T00:00:00+00:00 and 
2021-10-09T00:00:00+00:00",
+            id="no-description",
+        ),
+        pytest.param({"description": "World Cup"}, "World Cup", "World Cup", 
id="description"),
+        pytest.param(
+            {"restrict_to_events": True},
+            "5 events",
+            "5 events between 2021-09-06T00:00:00+00:00 and 
2021-10-09T00:00:00+00:00",
+            id="restrict-to-events",
+        ),
+        pytest.param({"event_dates": []}, "0 events", "No events", id="empty"),
+    ],
+)
+def test_sdk_timetable_decodes_to_core_timetable(kwargs, expected_summary, 
expected_description):
+    sdk_timetable = SdkEventsTimetable(**{"event_dates": EVENT_DATES_SORTED, 
**kwargs})
+    timetable = decode_timetable(encode_timetable(sdk_timetable))
+    assert isinstance(timetable, EventsTimetable)
+    assert timetable.summary == expected_summary
+    assert timetable.description == expected_description
+    assert timetable.event_dates == sdk_timetable.event_dates
+    assert timetable.restrict_to_events == sdk_timetable.restrict_to_events

Reply via email to