Andrew Moist

06/11/2021, 4:04 PM
Hi, I'd like to register a flow multiple times with a different schedule and parameters for each one. Is this possible? I can see from this page in the docs it’s possible to set a start time, but no schedule.  The reason is that we're investing creating a single generic flow that can handle different source data based on input parameters.

Kevin Kho

06/11/2021, 4:15 PM
Hi @Andrew Moist, you can attach multiple Clocks to a Schedule like this:
clock1   = clocks.IntervalClock(...)
clock2   = clocks.CronClock(...)

# the full schedule
schedule = Schedule(clocks=[clock1, clock2])

flow.schedule = schedule
You can also use the GraphQL to set it up like this .

Zach Schumacher

06/11/2021, 4:25 PM
I had a similar use case and had to get creative and used jinja templating, worked very well. Parameters weren’t working exactly right for what I needed to get done. We then run some codegen using jinja as part of our CI pipeline. You could also just get a cron schedule from an env variable or perhaps use prefect’s built in templating like this

Andrew Moist

06/11/2021, 4:41 PM
@Kevin Kho Thanks, I'll have a play with the GraphQL example you provided. @Zach Schumacher Yes, our team have also been discussing using jinja templating, although it feels like the wrong solution... just looking for a cleaner solution.