python - Airflow BashOperator 针对特定路径
问题描述
在气流任务中,我想使用 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))
解决方案
推荐阅读
- powerbi - 取消两次虚假预订交易并计算两次交易之间的日期差异
- rest - 连接到 Confluent Cloud - curl: (52) 来自服务器的空回复
- python - 在列表中使用 distinct() 函数。不同的功能在列表中不起作用
- c# - C# 不会编译
- java - TabLayout OnPageChangeListener 不能应用于“()”
- php - cURL 在一个请求后继续运行而不是停止
- bash - 一个脚本中的多个自动完成功能
- r - 从 R 中的公式对象中删除“公式”类
- php - Symfony 等效于 curl_setopt 使用 httpClientInterface 服务
- flutter - 如何在 Flutter 中使用蓝牙信标(BLE)实现扫描和传输数据