Hey all - is there a way to have multiple `Interva...
# ask-community
j
Hey all - is there a way to have multiple
IntervalSchedule
similar to having multiple clocks in the docs (https://docs.prefect.io/core/concepts/schedules.html#clocks)? What would be the recommended way to have a single flow that can run on 2 schedules (say every 5 minutes and every 30 minutes)? I guess we could probably achieve this with a 1 minute schedule and check within the flow run if
now().minute == 30
or
now().minute % 5 == 0
or some similar method but just wondering what would "prefecters" do...
1
n
Hi @Jeremy Yeo - this is definitely possible! To do that, you could do this:
Copy code
schedule = Schedule(clocks=[IntervalClock(timedelta(minutes=5)), IntervalClock(timedelta(minutes=30))])
👍 1
You can even mix and match different clocks on your schedule, so doing something like this would also work:
Copy code
schedule = Schedule(clocks=[IntervalClock(timedelta(minutes=5)), IntervalClock(timedelta(minutes=30)), CronClock("30 * * * *")])
j
Hey @nicholas - just realised that the example on the page I linked is exactly this - 2 different intervals... my eyes apparently failed me when reading that page 😛 thank you though.
n
No worries! 😁