amoghrajesh commented on code in PR #57354:
URL: https://github.com/apache/airflow/pull/57354#discussion_r2469249006


##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -1192,30 +1192,26 @@ def _run_task_state_change_callbacks(
             log.exception("Failed to run task callback", kind=kind, index=i, 
callback=callback)
 
 
-def _get_email_subject_content(
-    *,
-    task_instance: RuntimeTaskInstance,
-    exception: BaseException | str | None,
+def _send_error_email_notification(
+    task: BaseOperator | MappedOperator,
+    ti: RuntimeTaskInstance,
+    context: Context,
+    error: BaseException | str | None,
     log: Logger,
-) -> tuple[str, str, str]:
-    """
-    Get the email subject content for exceptions.
-
-    :param task_instance: the task instance
-    :param exception: the exception sent in the email
-    :param task:
-
-    :meta private:
-    """
-    from airflow.sdk.definitions._internal.templater import 
SandboxedEnvironment
-    from airflow.sdk.definitions.context import Context, 
render_template_to_string
+) -> None:
+    """Send email notification for task errors using SmtpNotifier."""
+    try:
+        from airflow.providers.smtp.notifications.smtp import SmtpNotifier
+    except ImportError:
+        log.error("Cannot send email notification: 
`apache-airflow-providers-smtp` is not installed.")

Review Comment:
   Better here: 
https://github.com/apache/airflow/pull/57354/commits/76f0974ae9c33745561a62b1dad6ad23be4c2fa6



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