使用 Airflow 中的另一个 dag 触发外部 dag

Triggering the external dag using another dag in Airflow

具有调用主节点中不同 dag 的任务列表 dag.I正在使用 TriggerDagrunoperator 来完成此任务。但面临的问题很少。

.. I want that to wait until completion .. Came across ExternalTaskSensor. It is making the process complicated ..

我不知道有任何其他方法可以实现此目的。这是我自己做的 .


If I trigger the master dag again, I want the task to restart from where it is failed...

你的这个要求违背了principle of idempotency that Airflow demands. I'd suggest you try to re-work you jobs in incorporate idempotency (for instance in case of retries, you have to have idempotency). Meanwhile you can take inspiration from some people并尝试实现类似的东西(但它会很复杂)

使用 Airflow 2.0.1,触发 dag 可以通过参数 wait_for_completion

等待目标 dag 完成

参考:here