airflow任务运行抛出jinja2.exceptions.TemplateNotFound
Posted cord
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了airflow任务运行抛出jinja2.exceptions.TemplateNotFound相关的知识,希望对你有一定的参考价值。
这是由于airflow使用了jinja2作为模板引擎导致的一个陷阱,当使用bash命令的时候,尾部必须加一个空格:
- Described here : see below. You need to add a space after the script name in cases where you are directly calling a bash scripts in the
bash_command
attribute ofBashOperator
- this is because the Airflow tries to apply a Jinja template to it, which will fail.
t2 = BashOperator(
task_id=‘sleep‘,
bash_command="/home/batcher/test.sh", // This fails with `Jinja template not found` error
#bash_command="/home/batcher/test.sh ", // This works (has a space after)
dag=dag)
参考链接:
https://stackoverflow.com/questions/42147514/templatenotfound-error-when-running-simple-airflow-bashoperator
https://cwiki.apache.org/confluence/display/AIRFLOW/Common+Pitfalls
以上是关于airflow任务运行抛出jinja2.exceptions.TemplateNotFound的主要内容,如果未能解决你的问题,请参考以下文章