Hi all, how can I skip all the tasks in the flow i...
# ask-community
p
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
Is it Prefect 2.0 or 1.0 question?
p
1.0
a
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,
)
👍 1