meetri commented on issue #24538:
URL: https://github.com/apache/airflow/issues/24538#issuecomment-1159467742

   Not sure how to or if it's worth making a pull request for this, but here is 
the change I made to get airflow scheduler back working.
   ```
   diff --git a/airflow/callbacks/callback_requests.py 
b/airflow/callbacks/callback_requests.py
   index 8112589cd..ecf0ae1c2 100644
   --- a/airflow/callbacks/callback_requests.py
   +++ b/airflow/callbacks/callback_requests.py
   @@ -16,6 +16,7 @@
    # under the License.
   
    import json
   +from datetime import date, datetime
    from typing import TYPE_CHECKING, Optional
   
    if TYPE_CHECKING:
   @@ -76,7 +77,13 @@ class TaskCallbackRequest(CallbackRequest):
        def to_json(self) -> str:
            dict_obj = self.__dict__.copy()
            dict_obj["simple_task_instance"] = 
dict_obj["simple_task_instance"].__dict__
   -        return json.dumps(dict_obj)
   +
   +        def datetime_serializer(obj):
   +            if isinstance(obj, (datetime, date)):
   +                return obj.isoformat()
   +            raise TypeError(f"Type {type(obj)} not serializable")
   +
   +        return json.dumps(dict_obj, default=datetime_serializer)
   
        @classmethod
        def from_json(cls, json_str: str):
   ```


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