gbonazzoli commented on issue #53135:
URL: https://github.com/apache/airflow/issues/53135#issuecomment-3146952589

   @eladkal 
   
   In Airflow 3.0.3 the problem arises also using SmtpNotifier:
   
   ```python
   email_notifier = SmtpNotifier(to=['[email protected]'])
   
   default_args = {
       'owner': 'gbonazzoli',
       'retries': 0,
       'start_date' : datetime(2023, 7, 1, 0, 0),
       'catchup' : False,  # The catchup defines if the DAG should run for 
every interval from it’s start time until the current time or not
       'on_failure_callback': [email_notifier],
   }
   ```
   
   I can force the error with a BashOperator pointing to a non existing path 
(/usr/bin/javaZZ):
   
   ```python
       Show_Java_Version = BashOperator(
           task_id = 'Show_Java_Version',
           bash_command = '/usr/bin/javaZZ --version'
       )
   ```
   
   and the log is:
   
   ```
   [2025-08-03, 05:27:20] INFO - Connection Retrieved 'smtp_default': 
source="airflow.hooks.base"
   [2025-08-03, 05:27:20] ERROR - Failed to send notification: 
'airflow.sdk.execution_time.task_runner.RuntimeTaskInstance object' has no 
attribute 'mark_success_url': 
source="airflow.providers.smtp.notifications.smtp.SmtpNotifier"
   UndefinedError: 'airflow.sdk.execution_time.task_runner.RuntimeTaskInstance 
object' has no attribute 'mark_success_url'
   File 
"/root/venv/lib/python3.12/site-packages/airflow/sdk/bases/notifier.py", line 
105 in __call__
   File 
"/root/venv/lib/python3.12/site-packages/airflow/providers/smtp/notifications/smtp.py",
 line 139 in notify
   File 
"/root/venv/lib/python3.12/site-packages/airflow/sdk/definitions/_internal/templater.py",
 line 121 in _do_render_template_fields
   File 
"/root/venv/lib/python3.12/site-packages/airflow/sdk/definitions/_internal/templater.py",
 line 177 in render_template
   File 
"/root/venv/lib/python3.12/site-packages/airflow/sdk/bases/notifier.py", line 
57 in _render
   File 
"/root/venv/lib/python3.12/site-packages/airflow/sdk/definitions/_internal/templater.py",
 line 133 in _render
   File "/root/venv/lib/python3.12/site-packages/airflow/utils/helpers.py", 
line 244 in render_template_to_string
   File "/root/venv/lib/python3.12/site-packages/airflow/utils/helpers.py", 
line 239 in render_template
   File "<template>", line 41 in root
   File "/root/venv/lib/python3.12/site-packages/jinja2/runtime.py", line 859 
in _fail_with_undefined_error
   ```
   
   The problem remains also if you try to force in airflow.cfg the use of 
custom templates with:
   
   ```python
   subject_template = /root/airflow/airflow.cfg.subject_template
   html_content_template = /root/airflow/airflow.cfg.html_content_template
   ```


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