vatsrahul1001 opened a new issue, #75007:
URL: https://github.com/apache/airflow/issues/75007

   ### Apache Airflow version
   
   3.4.0b1 (v3-4-test)
   
   ### What happened
   
   An asset-triggered timetable deserializes `batch_asset_events` to **`True`** 
when the key is absent from the serialized data, but the authoring/config 
default is **`False`** (asset-event batching is opt-in, added in #68517). So 
any serialized DAG whose blob lacks the key — every DAG serialized before 3.4, 
and the transient window after upgrade before the dag-processor re-parses — 
comes back with `batch_asset_events=True`, silently batching queued asset 
events into a single DAG run instead of one run per event.
   
   The three deserialize sites all hardcode the `True` fallback:
   - `airflow-core/src/airflow/timetables/simple.py:251` 
(`AssetTriggeredTimetable`)
   - `airflow-core/src/airflow/timetables/simple.py:465` 
(`PartitionedAssetTimetable`)
   - `airflow-core/src/airflow/timetables/assets.py:71` (`AssetOrTimeSchedule`)
   
   whereas the attrs field default is 
`attrs.Factory(_get_default_batch_asset_events)` which returns 
`conf.getboolean("scheduler", "batch_asset_events", fallback=False) or 
get_batching_requirement() is not None` — i.e. `False` for a plain asset 
condition.
   
   ### What you think should happen instead
   
   Deserializing a blob without the key should yield the same value as 
authoring the timetable — `False` for a plain condition (and `True` for 
AND/partition conditions, which *require* batching). I.e. the absent-key 
fallback should defer to the construct-time factory default, not a hardcoded 
`True`.
   
   ### How to reproduce
   
   ```python
   from airflow.sdk import Asset
   from airflow.timetables.simple import AssetTriggeredTimetable
   
   tt = AssetTriggeredTimetable(assets=Asset("x"))
   print(tt.batch_asset_events)                       # False  (opt-in default)
   
   legacy_blob = {"asset_condition": tt.serialize()["asset_condition"]}   # key 
omitted
   restored = AssetTriggeredTimetable.deserialize(legacy_blob)
   print(restored.batch_asset_events)                 # True   <-- bug
   ```
   
   Confirmed on v3-4-test. A normal round-trip (`deserialize(tt.serialize())`, 
key present) correctly returns `False`.
   
   ### Suggested fix
   
   At each deserialize site, only pass `batch_asset_events` when the key is 
present so the attrs factory default applies when it is absent. A hardcoded 
`False` is **not** correct because AND-condition / partitioned timetables 
require batching (`True`).
   
   ### Are you willing to submit PR?
   
   Yes.
   
   ### Operating System / Deployment / Versions
   
   v3-4-test branch (3.4.0).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to