If I have a complex schedule with an hourly interv...
# ask-community
l
If I have a complex schedule with an hourly interval clock and a cron clock - will there be 2 runs 1 of the clocks take precedence for an overlap, or will there be 2 scheduled runs?
k
There will be two runs because this is a use case when you can have different parameters associated with the clocks
upvote 1
l
Can I use an adjustment filter to forgo one of the schedules for the clash time?
k
I am not sure because the filter is on a schedule level right? Not the clock level?
l
Yes - you’re right, it is on the schedule level
a
Can you explain your use case? what would be your end goal by setting this schedule? Can you share the schedule configuration code you have so far?
l
My end goal is to run 1 more task in a flow for a certain hour of the day - specifically in times of low volume in my system
Copy code
flow.schedule = Schedule(
    clocks=[
        CronClock(
            cron="0 1 * * *",
            parameter_defaults={"parameter": True}
        ),
        IntervalClock(
            interval=timedelta(hours=1)
        )
    ]
)
I would want the CronClock to run with a specific param that would run an additional piece of logic in one of my tasks
a
I think this clock will give you the result you are looking for if you want to have 2 simultaneous flow runs - here is how you can test it:
Copy code
from datetime import timedelta
from prefect.schedules import Schedule
from prefect.schedules.clocks import IntervalClock, CronClock


schedule = Schedule(
    clocks=[
        CronClock(cron="0 1 * * *", parameter_defaults={"parameter": True}),
        IntervalClock(interval=timedelta(hours=1)),
    ]
)

for sched in schedule.next(20):
    print(sched)
result is that at 1 AM there are 2 runs, as you wanted:
Copy code
2022-05-06T19:00:00+00:00
2022-05-06T20:00:00+00:00
2022-05-06T21:00:00+00:00
2022-05-06T22:00:00+00:00
2022-05-06T23:00:00+00:00
2022-05-07T00:00:00+00:00
2022-05-07T01:00:00+00:00
2022-05-07T01:00:00+00:00
2022-05-07T02:00:00+00:00
2022-05-07T03:00:00+00:00
2022-05-07T04:00:00+00:00
2022-05-07T05:00:00+00:00
2022-05-07T06:00:00+00:00
2022-05-07T07:00:00+00:00
2022-05-07T08:00:00+00:00
2022-05-07T09:00:00+00:00
2022-05-07T10:00:00+00:00
2022-05-07T11:00:00+00:00
2022-05-07T12:00:00+00:00
2022-05-07T13:00:00+00:00
l
I’m looking for just 1 run when the clocks clash
I think I can just have separate flows though
a
but if you want only a specific task to run only in 1 extra run per day, then separating it out into a child flow and scheduling this single run separately (via a different scheduled flow) is the result you are looking for
👍 1
l
Got it - thanks Anna and Kevin
👍 1