我对Airflow和BashOperator都是新手,正在努力学习。我想在我的dag.py中使用BashOperator访问一个shell脚本。
我查看了以下内容: 如何在Airflow中运行bash脚本文件 和 BashOperator未在apache airflow中运行bash文件 以了解如何通过BashOperator访问shell脚本。
这是我所做的:
我查看了以下内容: 如何在Airflow中运行bash脚本文件 和 BashOperator未在apache airflow中运行bash文件 以了解如何通过BashOperator访问shell脚本。
这是我所做的:
cmd = "./myfirstdag/dag/lib/script.sh "
t_1 = BashOperator(
task_id='start',
bash_command=cmd
)
在运行我的脚本并在airflow中检查后,我收到了以下错误消息:[2018-11-01 10:44:05,078] {bash_operator.py:77} INFO - /tmp/airflowtmp7VmPci/startUDmFWW: line 1: ./myfirstdag/dag/lib/script.sh: No such file or directory
[2018-11-01 10:44:05,082] {bash_operator.py:80} INFO - Command exited with return code 127
[2018-11-01 10:44:05,083] {models.py:1361} ERROR - Bash command failed
不确定为什么会出现这种情况,希望能得到帮助。
谢谢!
编辑备注:我猜它在搜索一些airflow临时位置而不是我提供的路径。但是我该如何让它搜索正确的路径。
./myfirstdag/dag/lib/script.sh
相对于$AIRFLOW_HOME/dags
目录吗? - SergiyKolesnikovscript.sh
的绝对路径是什么? - SergiyKolesnikov