Hello! I’m pretty new to the tool but love it so f...
# prefect-community
Hello! I’m pretty new to the tool but love it so far! I have a question, if I have a flow, the flow is registered and has parameters, can I schedule 2 flow runs at two different schedules with different parameters? I know I can easily do a one time run in the UI with diff parameters.
Hi @Anze Kravanja -- off the top of my head you could just register the same flow with two names then set the schedule on each. I’m not sure there’s a straightforward way to get two overlapping schedules on a single flow, although the CRON syntax is pretty powerful so you could probably achieve your target schedule in a single one.
Yes, I think that’s a solid option, but in some cases I might not know how many flows I want to run with different params. For example, pulling some data based on an account id will always have the same flow, but I might get more and more account ids to run for. So I could just register a new flow each time, which would require adding code, but if I could just schedule another run with a new set of params and a schedule that would be cleaner.
Hi @Anze Kravanja - this is doable without re-registering! To do that you would use varying parameter clocks. Which look something like this in your code:
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
🦜 1
🤯 thanks Nicholas 🙂
Awesome stuff! Thank you very much! I suppose this same thing can’t be done via UI yet, but I have a feeling the API might have support for this.
That's correct @Anze Kravanja - the UI supports multiple clocks on the flow group but doesn't yet support varying parameters by clock
@Marvin archive “How can I schedule two different runs with two different parameter values?”