Enhanced multiple schedule support 📅
prefect.yaml
now supports specifying multiple schedules via the schedules
key.
This allows you to define multiple schedules for a single deployment, and each schedule can have its own cron
, interval
, or rrule
configuration:
...
schedules:
- cron: "0 0 * * *"
active: false
- interval: 3600
active: true
- rrule: "FREQ=YEARLY"
active: true
In addition you can specify multiple schedules via arguments to prefect deploy
:
We've also added support for multiple schedules to This will create a deployment with three schedules, one that runs every hour, one that runs every two hours, and one that runs every four hours. For more advanced cases, use the Dive into these new scheduling capabilities today and streamline your workflows like never before.
prefect deploy ... --cron '4 * * * *' --cron '1 * * * *' --rrule 'FREQ=DAILY'
More detail
flow.serve
, flow.deploy
and prefect.runner.serve
. You can provide multiple schedules by passing a list to the cron
, interval
, or rrule
arguments:
import datetime
import random
from prefect import flow
@flow
def trees():
tree = random.choice(["🌳", "🌴", "🌲", "🌵"])
print(f"Here's a happy little tree: {tree}")
if __name__ == "__main__":
trees.serve(
name="trees",
interval=[3600, 7200, 14400],
)
schedules
argument.
trees.serve(
name="trees",
schedules=[
IntervalSchedule(interval=datetime.timedelta(minutes=30)),
{"schedule": RRuleSchedule(rrule="FREQ=YEARLY"), "active": True},
MinimalDeploymentSchedule(schedule=CronSchedule(cron="0 0 * * *"), active=False),
]
)
For implementation details, see the following pull request:
- #12107
New Contributors 🌟
- Shoutout to @jrbourbeau for their first contribution!
See the release notes for more details!