psimakis
10/29/2020, 10:22 AMschedules.Schedule(
clocks=[
clocks.IntervalClock(timedelta(hours=1)), # clock 0: fire every hour
clocks.IntervalClock(timedelta(hours=5)), # clock 1: fire every five hours
],
# but only on weekdays for the second clock
filters=[filters.is_weekday_clock_1]
)
I know that filters are applied in scheduler level but it could be very handy to apply filtering on clock level. Is there any (even hackie) way to achieve this? If is not possible, is there any way to provide more that one scheduler to a flow?
Thanks in advance!Raphaël Riel
10/29/2020, 12:11 PMprefect.schedules.clocks.CronClock
for this Scheduler.
1st Cron: 0 */1 * * *
2nd Cron: 0 */5 * * 1-5
This way wou’ll get the expected result, without the need of Filters.At minute 0 past every 5th hour on every day-of-week from Monday through Friday.
psimakis
10/29/2020, 12:38 PM>>> import datetime
>>> import croniter
>>> cron = croniter.croniter('0 0 1-7 * 4')
>>> cron.get_next(datetime.datetime)
datetime.datetime(2020, 11, 1, 0, 0)
>>> cron.get_next(datetime.datetime)
datetime.datetime(2020, 11, 2, 0, 0)
>>> cron.get_next(datetime.datetime)
datetime.datetime(2020, 11, 3, 0, 0)
Raphaël Riel
10/29/2020, 12:57 PMday_or=False
will skip the Legacy/Problematic Behaviour:
https://stackoverflow.com/questions/34357126/why-crontab-uses-or-when-both-day-of-month-and-day-of-week-specified
On my side:CronClock
psimakis
10/29/2020, 1:13 PMnicholas
psimakis
11/04/2020, 3:01 PMnicholas