You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jgoedeke (via GitHub)" <gi...@apache.org> on 2026/08/31 08:39:53 UTC

[I] `datetime.timedelta` serde cannot deserialize integer payloads, crashing scheduler during DeadlineAlert DAG-run creation [airflow]

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

   ### Under which category would you file this issue?
   
   Task SDK
   
   ### Apache Airflow version
   
   3.3.0
   
   ### What happened and how to reproduce it?
   
   The scheduler crashes while creating an asset-triggered DAG run for a DAG with a `DeadlineAlert` interval of `timedelta(minutes=45)`.
   
   The serialized DAG payload observed in the scheduler traceback contains:
   
   ```python
   {
       "__classname__": "datetime.timedelta",
       "__version__": 2,
       "__data__": 2700,
   }
   ```
   
   The SDK datetime deserializer only accepts `str | float` for `datetime.timedelta`:
   
   ```python
   if cls is datetime.timedelta and isinstance(data, str | float):
       return datetime.timedelta(seconds=float(data))
   ```
   
   Since `2700` is an `int`, deserialization raises:
   
   ```text
   TypeError: unknown date/time format datetime.timedelta
   ```
   
   The exception is unhandled in scheduler DAG-run creation and terminates the scheduler process.
   
   ### Minimal reproduction
   
   ```python
   from datetime import timedelta
   
   from airflow.sdk.serde import CLASSNAME, DATA, VERSION, deserialize
   
   serialized_timedelta = {
       CLASSNAME: "datetime.timedelta",
       VERSION: 2,
       DATA: 2700,
   }
   
   assert deserialize(serialized_timedelta) == timedelta(minutes=45)
   ```
   
   ### Actual result
   
   ```text
   TypeError: unknown date/time format datetime.timedelta
   ```
   
   ### Expected result
   
   ```python
   timedelta(minutes=45)
   ```
   
   ### Proposed fix
   
   Accept integer second values alongside the already accepted string and float forms.
   
   
   ### What you think should happen instead?
   
   _No response_
   
   ### Operating System
   
   _No response_
   
   ### Deployment
   
   None
   
   ### Apache Airflow Provider(s)
   
   _No response_
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Official Helm Chart version
   
   Not Applicable
   
   ### Kubernetes Version
   
   _No response_
   
   ### Helm Chart configuration
   
   _No response_
   
   ### Docker Image customizations
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] `datetime.timedelta` serde cannot deserialize integer payloads, crashing scheduler during DeadlineAlert DAG-run creation [airflow]

Posted by "CaptainAni187 (via GitHub)" <gi...@apache.org>.
CaptainAni187 commented on issue #72319:
URL: https://github.com/apache/airflow/issues/72319#issuecomment-5586088480

   Reproduced on main and opened #72710 with the widening you suggested.
   
   I went looking for what actually emits the bare int and couldn't pin it down from inside the repo — `serialize()` writes `total_seconds()` as a float, `BaseSerialization` does the same, and a JSON round-trip keeps `2700.0` intact. So I've written the PR as a defensive widening rather than claiming to have traced your traceback. If you happen to know which producer the payload came through, that'd be useful to note on the PR.
   
   Either way the value is clearly reachable, and the `datetime` branch a few lines above already accepts `int | float` for the same kind of cross-producer reason, so accepting it one type down seems consistent.
   
   Test is parametrised over int/float/str — on main only the int case fails, which keeps it pinned to the actual broken path.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] `datetime.timedelta` serde cannot deserialize integer payloads, crashing scheduler during DeadlineAlert DAG-run creation [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk closed issue #72319: `datetime.timedelta` serde cannot deserialize integer payloads, crashing scheduler during DeadlineAlert DAG-run creation
URL: https://github.com/apache/airflow/issues/72319


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org