Nicholas Pini
07/21/2026, 3:43 PMMarvin
07/21/2026, 3:43 PMMarvin
07/21/2026, 3:44 PMFlowRun, you can get its duration from flow_run.total_run_time.
Example:
python
duration = flow_run.total_run_time
print(duration.total_seconds())
A few useful details:
- total_run_time is a datetime.timedelta
- For a completed flow run, this is usually the best field to use
- If you want wall-clock elapsed time instead, you can also compute:
python
if flow_run.start_time and flow_run.end_time:
elapsed = flow_run.end_time - flow_run.start_time
Difference:
- total_run_time = accumulated runtime tracked by Prefect
- end_time - start_time = simple elapsed time between start and finish
If you want, I can also show how to retrieve the FlowRun first using the Prefect client.