Learn how to create schedules for your deployments.
cron
, interval
, or rrule
parameters if building your deployment with the
serve
method of the Flow
object or
the serve
utility for managing multiple flows simultaneouslyflow.serve
or flow.deploy
prefect deploy
commanddeployments
-> schedules
section of the prefect.yaml
fileflow.serve()
, serve
, flow.deploy()
, or deploy
.
Just add the keyword argument cron
, interval
, or rrule
.
Argument | Description |
---|---|
interval | An interval on which to execute the deployment. Accepts a number or a timedelta object to create a single schedule. If a number is given, it is interpreted as seconds. Also accepts an iterable of numbers or timedelta to create multiple schedules. |
cron | A cron schedule string of when to execute runs of this deployment. Also accepts an iterable of cron schedule strings to create multiple schedules. |
rrule | An rrule schedule string of when to execute runs of this deployment. Also accepts an iterable of rrule schedule strings to create multiple schedules. |
schedules | A list of schedule objects defining when to execute runs of this deployment. Used to define multiple schedules or additional scheduling options such as timezone . |
schedule | A schedule object defining when to execute runs of this deployment. Used to define additional scheduling options such as timezone . |
slug | An optional unique identifier for the schedule containing only lowercase letters, numbers, and hyphens. If not provided for a given schedule, the schedule will be unnamed. |
serve
method below will create a deployment of my_flow
with a cron schedule that creates runs every minute of every day:
deploy
method has the same schedule-based parameters.
When my_flow
is served with this interval schedule, it will run every 10 minutes beginning at midnight on January, 1, 2026 in the America/Chicago
timezone:
prefect deploy
command. You will be prompted to choose which type of schedule to create.
You can also create schedules for existing deployments using the prefect deployment schedule create
command. This command allows you to specify schedule details directly without going through the interactive flow.
prefect deployment schedule create
adds additional schedules to your deployment.
Use the --replace
flag to remove old schedules and update with the new one.prefect.yaml
file from the prefect deploy
command, you will see it has a schedules
section for your deployment.
Alternatively, you can create a prefect.yaml
file from a recipe or from scratch and add a schedules
section to it.
.serve
or .deploy
, you can pass parameters
to your deployment schedules
:
message
parameter, but we’ve overridden it for the second schedule.
This deployment will schedule runs that:
prefect.schedules
.
You can provide one schedule via the schedule
kwarg or multiple schedules via schedules
.prefect.yaml
prefect.yaml
file.