<@ULVA73B9P> Is it possible not to run late flows?...
# ask-marvin
s
@Marvin Is it possible not to run late flows? I.e. I schedule flow to run every minute, but the the limit is set to 1 and the flow takes more than 1 minute to end. In this situation I only want to run new flows (those scheduled for the future)
m
To prevent running "late" flows in Prefect 3.x, you can utilize the scheduling features to ensure that only new, future-scheduled flows are executed. Here's a concise approach to achieve this: 1. Scheduling: You can define schedules using cron, interval, or rule parameters when deploying your flow. This setup can be done through the Prefect UI, CLI, or by configuring the
prefect.yaml
file. This ensures that your flows are scheduled at precise intervals. 2. Flow Execution Control: Prefect does not natively skip "late" runs directly, but you can manage flow execution by controlling the concurrency and scheduling intervals. You might consider using conditional logic within your flow to check the current time against the expected schedule time and decide whether to proceed with execution. 3. Deployment Configuration: When deploying a flow, you can specify execution parameters that might help in managing concurrent runs or preventing overlaps. For further details, you can explore the scheduling documentation here. If you're looking for a more programmatic solution, you might need to implement custom logic within your flow to check against the current schedule and decide whether to execute based on the current time.