Hi all, how can I skip all the tasks in the flow if there is holiday on that day or any particular date? Assuming I already have a list of holidays. What can be the best approach?
✅ 1
a
Anna Geller
06/13/2022, 11:16 AM
Is it Prefect 2.0 or 1.0 question?
p
Priyank
06/13/2022, 11:19 AM
1.0
a
Anna Geller
06/13/2022, 11:30 AM
you can use not_filters to exclude holidays:
Copy code
from prefect.schedules import filters, clocks, schedules
from datetime import timedelta
list_of_holidays = [] # list of datetime objects
sched = schedules.Schedule(
# fire every hour
clocks=[clocks.IntervalClock(timedelta(hours=1))],
# but only on weekdays
filters=[filters.is_weekday],
# exclude holidays
not_filters=list_of_holidays,
)
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.