https://prefect.io logo
j

jeff n

01/15/2021, 11:16 PM
Hello all. I have a flow that can take parameters such as db table and pull data from that table generically. How do I register the same flow to run in prefect cloud with different parameters. For instances the flow pulls from
projects
with one set of runs and
accounts
with another set of runs but both of the runs are the same flow code and need to run separately.
n

nicholas

01/15/2021, 11:23 PM
Hi @jeff n - are you running this flow on some sort of schedule or are you planning to run it only ad-hoc?
j

jeff n

01/15/2021, 11:23 PM
It will be run on a schedule @nicholas
n

nicholas

01/15/2021, 11:27 PM
Perfect! Prefect has a great way to handle that scenario using varying parameter clocks. So you could do something like this:
Copy code
clock1 = clocks.CronClock("1 * * * *", parameter_defaults={"foo": "bar"})
clock2 = clocks.CronClock("2 * * * *", parameter_defaults={"foo": "batz"})

schedule = Schedule(clocks=[clock1, clock2])

flow.schedule = schedule
That will let you override any defaults you set on the parameters based on the schedule (and you can kick off ad-hoc runs using the defaults or by passing parameters at any time outside the schedule!)
j

jeff n

01/15/2021, 11:31 PM
ah ok. Didn’t think of using schedules.
👍 1
@nicholas how will that look in the UI? Will it be just 1 flow that has lots of scheduled times?
n

nicholas

01/15/2021, 11:51 PM
That’s correct @jeff n
🙇 1