ramitkataria commented on code in PR #53831:
URL: https://github.com/apache/airflow/pull/53831#discussion_r2299307881


##########
airflow-core/tests/unit/triggers/test_deadline.py:
##########
@@ -22,13 +22,29 @@
 import pytest
 
 from airflow.models.deadline import DeadlineCallbackState
+from airflow.sdk import BaseNotifier
 from airflow.triggers.deadline import PAYLOAD_BODY_KEY, PAYLOAD_STATUS_KEY, 
DeadlineCallbackTrigger
 
+TEST_MESSAGE = "test_message"
 TEST_CALLBACK_PATH = "classpath.test_callback_for_deadline"
-TEST_CALLBACK_KWARGS = {"arg1": "value1"}
+TEST_CALLBACK_KWARGS = {"message": TEST_MESSAGE}
 TEST_TRIGGER = DeadlineCallbackTrigger(callback_path=TEST_CALLBACK_PATH, 
callback_kwargs=TEST_CALLBACK_KWARGS)
 
 
+class ExampleAsyncNotifier(BaseNotifier):
+    """Example of a properly implemented async notifier."""
+
+    def __init__(self, message, **kwargs):
+        super().__init__(**kwargs)
+        self.message = message
+
+    async def async_notify(self, context):
+        return f"Async notification: {self.message}, context: {context}"
+
+    def notify(self, context):
+        return f"Sync notification: {self.message}, context: {context}"

Review Comment:
   Currently, any notifier either supports both async and sync, or only sync. 
But, it is not necessary to support both in case someone wants to use a 
notifier only for deadline async callbacks. I kept the implementation of sync 
notify in this case as an example of what a notifier should implement ideally 
so it can be used for both



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