Skip to main content
 首页 » 编程设计

python之如果在已经运行的情况下多次运行同一个 dag 会怎样

2024年11月01日12txw1958

如果同时触发同一个 dag(或者运行时间重叠)会怎样?

询问是因为最近手动触发了一个 dag,当它的实际计划运行时间过去时,它最终仍在运行,此时,从网络服务器 UI 的角度来看,它又从头开始运行(我无法不再跟踪前一个实例)。这只是“运行实例”使 dag_id 过载的情况,还是作业真正重新启动(即先前的进程被终止)?

请您参考如下方法:

据我了解,这取决于触发方式以及 DAG 是否有时间表。如果它基于 DAG 中定义的计划,比如每天运行的任务未完成/仍在工作,并且您单击重新运行,那么该任务的实例将重新运行。即今天的那个。同样,如果频率是任何其他时间单位。

Note that DAG Runs can also be created manually through the CLI while running an airflow trigger_dag command, where you can define a specific run_id. The DAG Runs created externally to the scheduler get associated to the trigger’s timestamp, and will be displayed in the UI alongside scheduled DAG runs.

在您的例子中,听起来像是后者。希望对您有所帮助。