It seems that Prefect Cloud automations are designed to trigger actions based on specific events or conditions, such as changes in flow run states or other metrics. However, these automations typically apply to future events and may not automatically apply to existing flow runs unless specifically configured to do so.
For your specific requirement of handling flows that have been running for more than 3 hours, you might need to implement a custom solution. This could involve:
1.
Custom Script: Writing a script that periodically checks the status of existing flow runs and changes their status if they exceed the specified duration. This script would need to be run separately from the automations.
2.
Prefect API: Using the Prefect API to fetch flow runs, check their duration, and update their status accordingly. You can use the
get_client()
function to interact with the Prefect API programmatically.
Here are some useful links and resources:
-
Automations in Prefect Cloud
-
Prefect API Client
If you decide to write a custom script, make sure it runs at regular intervals to catch any long-running flows. This isn't something that automations handle out-of-the-box for existing runs.