gpt4 book ai didi

python - Airflow ExternalTask​​Sensors - 创建 dags 依赖

转载 作者:太空宇宙 更新时间:2023-11-04 02:41:48 24 4
gpt4 key购买 nike

我想在 DAG A 和 DAG B 上创建 dag 依赖项。DAG A 有两个任务:TASK1 和 TASK2。 DAG B 有 3 个任务:TASK1、TASK2 和 TASK3。

我的要求是 DAG B 在 DAG A TASK1 之后开始。

两个 DAGS 都每小时运行一次,DAG A 运行@every hours EX: 10.00 and DAG B runs @every hour ex:10.30.

我正在使用 Airflow 和运算符 EXternalTask​​Sensors,但它不工作。

external_dag_id='DAG A',
external_task_id='TASK1',
allowed_states=None,
execution_delta=None,
execution_date_fn=None,

最佳答案

如果你在那里检查 execution_delta,你没有,文档[ https://github.com/apache/incubator-airflow/blob/master/airflow/operators/sensors.py#L194]说:

:param execution_delta:time difference with the previous execution to look at, the default is the same execution_date as the current task. For yesterday, use [positive!] datetime.timedelta(days=1). Either execution_delta or execution_date_fn can be passed to ExternalTaskSensor, but not both.

简短的回答是,因为你在不同的时间运行 DAG A 和 DAG B,你需要放置 execution_delta,否则,它假设你的其他 DAG 同时运行,在这种情况下,没有找到 DAG 运行并且你可能会得到意想不到的东西。所以尝试像 datetime.timedelta(minutes=30)

关于python - Airflow ExternalTask​​Sensors - 创建 dags 依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46279361/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com