Hey guys, with the scheduling I'm just struggling for the server to actually pick it up. I want to fire my flow at 8pm each day and only on weekdays so:
Copy code
flow.schedule = Schedule(
clocks=[IntervalClock(timedelta(days=1))],
filters=[at_time(datetime.time(20)),is_weekday]
)
flow.schedule.next(10) #<- I have also added this line in but it's done nothing
a
Anna Geller
11/11/2021, 1:59 PM
@Adam Everington I think you need to add a start time like so:
schedules.clocks.IntervalClock(
start_date=pendulum.datetime(2021, 11, 11, tz="Europe/London"),
interval=timedelta(days=1)
)
a
Adam Everington
11/11/2021, 2:04 PM
no dice 😞
a
Anna Geller
11/11/2021, 2:13 PM
Maybe you can try a CronClock then?
CronClock( "0 20 * * *", start_date=pendulum.now())
✅ 1
a
Adam Everington
11/11/2021, 2:21 PM
way ahead of you... yep, that worked!
a
Anna Geller
11/11/2021, 2:26 PM
btw, this should also work with IntervalClock, just adding the hour:
Copy code
from datetime import timedelta
import pendulum
from prefect.schedules import Schedule
from prefect.schedules.clocks import IntervalClock
clock = IntervalClock(
start_date=pendulum.datetime(2021, 11, 11, 20, 0, tz="Europe/London"),
interval=timedelta(days=1),
)
schedule = Schedule(clocks=[clock])
print(schedule.next(10))
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.