airflow - 如何设置 Airflow 自定义电子邮件模板
问题描述
在 中airflow.cfg
,我已经设置了我需要的电子邮件外观,但是当发送电子邮件时,我指定的设置/布局没有被应用。
subject_template = 'Airflow alert: {{ti}}'
# File that will be used as the template for Email content (which will be rendered using Jinja2).
# If not set, Airflow uses a base template.
# Example: html_content_template = /path/to/my_html_content_template_file
html_content_template = (
'Try {{try_number}} out of {{max_tries + 1}}<br>'
'Job Name: {{ti.dag_id}}<br>'
'Task Id: {{ti.task_id}}<br>'
'Exception: {{exception_html}}<br>'
'Log: <a href={{ti.log_url}} target="_blank">Link</a><br>'
'Host: {{ti.hostname}}<br>'
'Log file: {{ti.log_filename}}<br>')
我错过了什么?
解决方案
来自html_content_template的文档:
将用作电子邮件内容模板的文件(将使用 Jinja2 呈现)。如果未设置,Airflow 将使用基本模板。
我猜期望值是这样的:
html_content_template = /path/to/my_html_content_template_file
尝试使用模板创建文件并在设置中提供该文件的路径。
推荐阅读
- mongodb - 原型 GraphQL、MongoDB——无模式?
- c# - C#从数据库中检索传递数据
- cmd - ImageMagick 通过 CMD 提示追加递归子目录
- python - 根据另一个数组将numpy数组填充到位置
- ios - 快速捕捉实况照片
- ruby-on-rails - 如何将具有范围的搜索过滤器添加到 Searchkick?(轨道 5)
- java - 如何在android中检查日期在10天内
- android - 带有 listview 错误结果的 searchview
- r - 使用 R 重塑数据(也许很容易,也许不简单)
- python - 如何使用 jira-python API 标记 Jira TC 执行状态失败或通过?