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

   ### Apache Airflow version
   
   main (development)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   `timedelta` fields like `dagrun_timeout` are serialized by pydantic to ISO 
8601 duration format. Rendering the value in frontend is not intuitive to the 
users and should probably be formatted as `HH:MM:SS` . E.g. 1 day 15 seconds is 
serialized as `P1DT15S`
   
   
https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.ser_json_timedelta
   
   ### What you think should happen instead?
   
   _No response_
   
   ### How to reproduce
   
   ```python
   from __future__ import annotations
   
   from datetime import timedelta
   
   import pydantic
   
   
   class TimedeltaExampleBase(pydantic.BaseModel):
       timeout: timedelta
   
   
   class TimedeltaExampleFloat(TimedeltaExampleBase):
       model_config = pydantic.ConfigDict(ser_json_timedelta="float")
   
   
   class TimedeltaExampleISO(TimedeltaExampleBase):
       pass
   
   
   float_ser = TimedeltaExampleFloat.model_validate({"timeout": 
timedelta(days=1, seconds=15)})
   print(float_ser.model_dump_json())
   
   default_ser = TimedeltaExampleISO.model_validate({"timeout": 
timedelta(days=1, seconds=15)})
   print(default_ser.model_dump_json())
   ```
   
   Output
   
   ```
   {"timeout":86415.0}
   {"timeout":"P1DT15S"}
   ```
   
   ### Operating System
   
   Ubuntu 20.04
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   _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: [email protected]

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

Reply via email to