Quick question about schedules. I want a “once per...
# ask-community
n
Quick question about schedules. I want a “once per quarter” schedule, so I came up with this:
Copy code
schedule = Schedule(
    clocks=[IntervalClock(interval=timedelta(days=1)),],
    or_filters=[
        between_dates(start_month=1, start_day=1, end_month=1, end_day=1),
        between_dates(start_month=4, start_day=1, end_month=4, end_day=1),
        between_dates(start_month=7, start_day=1, end_month=7, end_day=1),
        between_dates(start_month=10, start_day=1, end_month=10, end_day=1),
    ],
)
Is that idiomatic Prefect? Or is there a more natural way of doing this? Another potential solution is to use
IntervalClock
with an interval of 3 months, except you can’t say
timedelta(months=3)
and get the interval to fire on the first of the month easily.
k
Hello again, I think this is good, but maybe you can use
on_datetime
instead to allow on that specific day?
Might be easier with the
CronClock
too. Something like
0 0 1 */3 *
n
Oh derp, yeah something like this:
Copy code
schedule = Schedule(
    clocks=[IntervalClock(interval=timedelta(days=1))],
    or_filters=[
        on_date(month=1, day=1),
        on_date(month=4, day=1),
        on_date(month=7, day=1),
        on_date(month=10, day=1),
    ],
)
Cron works too, but I definitely prefer the legibility of the other clock APIs. Thank you for the pointer!
👍 1