Hey guys, with the scheduling I'm just struggling ...
# ask-community
a
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
@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
no dice 😞
a
Maybe you can try a CronClock then? CronClock( "0 20 * * *", start_date=pendulum.now())
1
a
way ahead of you... yep, that worked!
a
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))