我使用的是Ubuntu 20.04和Airflow 2.0.1。
我在DAG中有一个BashOperator任务,如下所示:
proxy_update_getProxies = BashOperator(
task_id='proxy_update_getProxies',
bash_command="scripts/proxies-update-get.sh",
dag=dag)scripts文件夹在dag文件夹中,所以根据文档,应该可以像这样运行它。
proxies-update-get.sh脚本包含2行:
proxy-lists updateGeoIpData --license-key Y00qKC2A9ZoWVXJW
proxy-lists getProxies --protocols="https" --output-format="txt" --output-file="httpsproxies.txt"proxy-lists是一个nmp包,可以从命令行界面运行这两个命令来更新和获取代理列表。脚本在任何文件夹中都工作得很好,所以$PATH应该不会有问题,但我得到了这个错误:
can't open file 'proxy-lists': [Errno 2] No such file or directory我做错了什么?
发布于 2021-03-30 00:02:56
感谢@00和@PeterRing。
我只是在我的bash脚本中使用了节点CLI脚本的完整路径,它工作得很好:
/home/username/.nvm/versions/node/v14.16.0/lib/node_modules/proxy-lists/cli.js updateGeoIpData --license-key hshshhshshshsh
/home/username/.nvm/versions/node/v14.16.0/lib/node_modules/proxy-lists/cli.js getProxies --protocols="https" --output-format="txt" --output-file="/home/username/airflow/dags/scripts/httpsproxies.txt"https://stackoverflow.com/questions/66850898
复制相似问题