https://prefect.io logo
Title
o

Ofir

05/07/2023, 9:47 PM
Is it possible to trigger a flow on a bounded schedule, e.g. 2 weeks? We have an ML inference job that we would like to run for a bounded period of time, say 10 days. Is that possible to provide Prefect 2.0 a start and end date and ensure a recurring daily schedule (e.g. every day at 2 am) that ends on a particular date?
d

Dominic Tarro

05/07/2023, 10:31 PM
There are practical reasons you can’t just toggle the deployment’s schedule on and off in the UI?
Assuming there is, here is a workaround 1. Create that deployment 2. Create a deployment for a new flow a. This deployment runs on the 10 day interval b. The flow sets the target deployment’s
is_schedule_active
to false and then saves it
d

Deceivious

05/08/2023, 8:34 AM
U can do it with RRULE
o

Ofir

05/08/2023, 9:03 PM
@Dominic Tarro thank you for the advice! how do you programmatically set the
is_schedule_active
to false? I saw this field in the deployment yaml but I’d rather avoid manually modifying files and instead use the Prefect REST API
@Deceivious what’s RRULE?
Ahhh that’s amazing
RRULE:FREQ=MONTHLY;BYDAY=-2FR;COUNT=7
Thank you so much!
God I love Prefect
d

Deceivious

05/09/2023, 3:28 PM
Great that you found rule by yourself 😂 that's kinda hard to explain
o

Ofir

05/09/2023, 5:29 PM
lol 😄