uranusjr commented on issue #17814:
URL: https://github.com/apache/airflow/issues/17814#issuecomment-904787987


   The code is in `airflow/www/views.py`. Search for `def last_dagruns` and the 
error is toward the bottom of the function.
   
   Change this
   
   ```python
   resp = {
       r.dag_id.replace('.', '__dot__'): {
           "dag_id": r.dag_id,
           "execution_date": r.execution_date.isoformat(),
           "start_date": r.start_date.isoformat(),
       }
       for r in query
   }
   ```
   
   to something like this:
   
   ```python
   def _datetime_to_string(value: Optional[DateTime]) -> Optional[str]:
       if value is None:
           return None
       return value.isoformat()
   
   resp = {
       r.dag_id.replace('.', '__dot__'): {
           "dag_id": r.dag_id,
           "execution_date": _datetime_to_string(r.execution_date),
           "start_date": _datetime_to_string(r.start_date),
       }
       for r in query
   }
   ```
   
   I had this fix in another PR (not merged to main yet), but if you could 
submit a PR just for this change, it can likely be merged pretty quickly and 
included in 2.1.4.


-- 
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