Airflow BashOperator定位特定路径

时间:2018-08-20 14:13:32

标签: python bash curl airflow string-interpolation

在气流任务中,我想使用BashOperator调用CURL以下载.csv。我想将其保存在特定位置。这是使用明智的模式还是有更好的方法(也许使用模板?):

from pathlib import Path
base_path = Path('/home/dan.golding/projects/subproject/results')

,然后在DAG with语句中:

t1 = BashOperator(
        task_id='task_1',
        bash_command=f"curl -X GET 'https://myurl.com/api.php?paramname=paramvalue' > {base_path / 'my_result.csv'}"
        retries=2,
        retry_delay=timedelta(minutes=1))

0 个答案:

没有答案
相关问题