气流 - 暂停/取消暂停并行运行的同一 DAG 的单个 dagruns [英] Airflow - pause/unpause individual dagruns of the same DAG running in parallel
问题描述
我们目前正在评估一个项目的气流.我想知道是否有办法在并行运行 DAG 的同时停止/启动单个 dagruns.在 dag_id 上暂停/取消暂停似乎暂停/取消暂停 dag 下的所有 dagruns.相反,我们想要暂停单个 dagruns(或其中的任务).让我知道这是否可以在气流中实现.
We are currently evaluating airflow for a project. I was wondering if there is a way to stop/start individual dagruns while running a DAG multiple times in parallel. Pause/unpause on dag_id seems to pause/unpause all the dagruns under a dag. Instead we want to pause individual dagruns (or tasks within them). Let me know if this is achievable in airflow.
如果不可能,这里有我正在考虑的其他替代方案,让我知道您对这些的看法
If its not possible, here are other alternatives I am thinking of, let me know your opinion on these
- 更改任务状态.– 将 dagrun 下的所有任务更改为标记失败或成功.这样,特定的达格朗就会停在其轨道上,而不会影响其他达格朗.
- 气流传感器从 s3 或 http 或 sql 或某处提取此信息以暂停当前的 dagrun.如果需要停止此 dagrun(而不是其他 dagrun),并且每次都有任务检查 s3.
- 子标签.- 我们可以暂停/取消暂停 subdags.这样,对于我们想要执行的每个并行用户的请求,我们都会发出一个 subdag,我们可以暂停 userAs subdag 而不会影响其他用户的 subdag.
推荐答案
没有什么是烘焙"的进入 Airflow 以支持这一点,但您可以(ab)使用 DagRun
的状态,方法是将其更改为 failed"
以暂停然后返回到 "运行
"以恢复;您将无法全面取消暂停,但为了测试它应该是可行的.
There's nothing "baked" into Airflow to support this but you could (ab)use the state of the DagRun
by changing it to "failed"
to pause and then back to "running"
to resume; you won't be able to blanket unpause but for testing it should be workable.
这篇关于气流 - 暂停/取消暂停并行运行的同一 DAG 的单个 dagruns的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!