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


##########
task-sdk/src/airflow/sdk/bases/notifier.py:
##########
@@ -104,4 +132,23 @@ def __call__(self, *args) -> None:
         try:
             self.notify(context)
         except Exception as e:
-            self.log.exception("Failed to send notification: %s", e)
+            self.log.exception("Failed to send (blocking) notification: %s", e)
+
+    def __await__(self) -> Generator[Any, None, None]:
+        """
+        Make the notifier awaitable.
+
+        Context provided in the constructor is used.
+        """
+        self._update_context(self.context)
+        self.render_template_fields(self.context)
+        try:
+            return self.async_notify(self.context).__await__()

Review Comment:
   After the error handling change I mentioned, we don't need the empty 
generator which makes it shorter than `__call__`. So I don't think we need to 
move it to a separate function. But if you would still like me to do it, then I 
think it should done for both `__call__` and `__await__`.
   Also, I would like to keep the usage as similar to the current usage as 
possible so I want to avoid making the API `await n.async_notify()`



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