ferruzzi commented on code in PR #53201:
URL: https://github.com/apache/airflow/pull/53201#discussion_r2205565067


##########
airflow-core/src/airflow/models/deadline.py:
##########
@@ -98,6 +107,33 @@ def _determine_resource() -> tuple[str, str]:
             f"{self.deadline_time} or run: {self.callback}({callback_kwargs})"
         )
 
+    def handle_miss(self, session: Session):
+        """Handle a missed deadline by creating and starting a trigger to run 
the callback."""
+        callback_func = import_string(self.callback)

Review Comment:
   Yeah, interesting.   The import_string() method was exactly the "decoding" I 
had in mind when I serialized the callback the way I did, but at the time we 
weren't thinking about sync vs async.... 
   
   I don't have a ton of experience with async python, but a quick google seems 
to imply that we could make an async wrapper... maybe a cleaner solution could 
be to send it all to the Triggerrer and add some logic to the effect of "if 
it's async then run it, else wrap it before running it" something like
   
   ```
   async def async_wrapper(callback):
       return await asyncio.to_thread(sync_function, callback)
   ```
   



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