我想在 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 和运算符 EXternalTaskSensors,但它不工作。
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)
