i using filters.at_time() to setting schedule for Flow. But i can't defind the schedule at time with timezone. How to do that? tks all
a
Anna Geller
01/11/2022, 10:50 AM
Can you explain without code what schedule do you want to attach, e.g. every day at 9 AM in your time zone? it could be that you can accomplish the same using just IntervalSchedule
But if you want to use at_time filter in your time zone, here is an example
Copy code
from datetime import timedelta
import pendulum
from prefect.schedules import Schedule
from prefect.schedules.clocks import IntervalClock
from prefect.schedules.filters import at_time
clock = IntervalClock(
start_date=pendulum.datetime(2022, 2, 1, 9, 0, tz="America/New_York"),
interval=timedelta(days=1),
)
schedule = Schedule(clocks=[clock], filters=[at_time(pendulum.time(9))])
for sched in schedule.next(10):
print(sched)
a
Anh Nguyen
01/12/2022, 2:02 AM
If i want to set multiple start time with time zone for schedule in day. how to do that ?
a
Anna Geller
01/12/2022, 7:41 AM
You can attach multiple clocks to your schedule. Can you explain what is the end outcome you try to achieve? Run the flow at X exact dates? Or run it at X different intervals (hourly, daily, weekly)?
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.