码迷,mamicode.com
首页 > 其他好文 > 详细

airflow任务运行抛出jinja2.exceptions.TemplateNotFound

时间:2018-06-26 00:52:46      阅读:565      评论:0      收藏:0      [点我收藏+]

标签:必须   comm   except   because   run   after   com   flow   air   

这是由于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 of BashOperator - 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

标签:必须   comm   except   because   run   after   com   flow   air   

原文地址:https://www.cnblogs.com/cord/p/9226628.html

(0)
(1)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!