有没有办法在 DAG 中找到任何随机任务所花费的时间?

Ash*_*mar 2 python directed-acyclic-graphs google-cloud-platform airflow

我需要通过DAG 中的任何特定任务查找时间量例如:

SampleTask=DummyOperator(
    task_id='SampleTask',
    dag=dag)
Run Code Online (Sandbox Code Playgroud)

现在我想知道上述任务所花费的时间是如何基于其 task_id 的,其他任务也是如此。

med*_*088 5

如果您从 Airflow UI转到Data Profiling > Ad Hoc Query,并选择airflow_db数据库,您可以发出以下查询:

select execution_date, duration from task_instance where task_id = 'SampleTask'
Run Code Online (Sandbox Code Playgroud)

duration列包含任务运行的秒数。