airflow任務運行拋出jinja2.exceptions.TemplateNotFound
阿新 • • 發佈:2018-06-26
fall erro direct sleep not found dag .com ng- add
這是由於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