How to re-schedule flow which already exists? We h...
# ask-community
v
How to re-schedule flow which already exists? We have scheduler job, and registered flow, is it possible to re-schedule it ?
m
Hello Vitaly! 👋 You can update the schedule of the flow in Settings -> Schedules tab.
Did you explicitly set a schedule on that flow?
v
Well, yes, but, we need to do it from within nightly running flow, UI is not an option
Is there a way to load exsiting flow and re-schedule it, or clone existing flow with another name and schedule
There is planner, or scheduler, which is working nightly, so, what can work for us: • register new flow with new schedule, afaik, registering of flow from within another running flow is not supported • clone exsting flow and updated schedule on it (how to do it)? • and, worst option, create many schedules of the same flow with different parameters (how to load existing flow?) any ideas?
m
My first thought would be to register a new flow with updated schedule, but let me ask the team, and I'll get back.
There are two ways: • create ad-hoc flow runs with specified start times using the API • use the GraphQL API to change the schedule on an existing flow -  
set_flow_group_schedule
Copy code
mutation {
  set_flow_group_schedule(input:
  	{flow_group_id: "<flow_group_id>", 
      cron_clocks: [{cron: "*/5 * * * *"}]}) {
    success
  }
}
r
why not to re-register?
It was not supported, I'm not sure if something changed
@Mariia Kerimova Do I understand right that registering another flow from within running flow is not yet supported?
m
Hey @Vitaly Shulgin! Right, registering flow within running flow is not currently supported.
v
Is there a way to clone flow, using GrpahQL API?
m
There is no clone flow option, but can you provide more information what you are trying to achieve, and we will try to find a workaround together? Did you fix the schedule on the flow btw?
v
No, I did not fixed
What we actually need: • read from database some data, and, based on that data, crate flow with specific name to be executed with specific parameter during next day • the idea was is to run nightly flow wich do it, no matter how, registering new flow or cloning existing one
so, flows are to be generated and scheduled nightly, and it looks like the only one option to do it, is to run by cron some python script, which is looking ugly, taking into account that we're running prefect
actually, cloning existing flow with another name and creating for it specific schedule with specific paramter should be enough
it already referencing correct set of tasks, and correct image which is to be used
Hey @Mariia Kerimova any ideas?
j
Hi Vitaly,
read from database some data, and, based on that data, crate flow with specific name to be executed with specific parameter during next day
Is the flow different for each run, or the same (or one of a few existing flows)? If you don't need a new dynamic flow for each run, just a dynamic run of it with specific parameters/a scheduled time you could make use of
StartFlowRun
to schedule a flow run for a specific flow with specific parameters at a scheduled time in the future. This would remove the need for dynamic registration of new flows, as you'd only be creating new flow runs for a specific flow.
v
Hi @Jim Crist-Harif, thanks, looks like it will work, it would be nice to have a feature,
ScheduleFlowRun
, where the regular prefect schedules, clocks and etc. could be used, is there any plan for something like
ScheduleFlowRun
?
j
Schedules are associated with a flow, not a flow run, so if you intend
ScheduleFlowRun
to set a new schedule on a flow run that doesn't really make sense (as schedules go on the flow).
StartFlowRun
can schedule a new flow run to run in the future at a specified time, giving you the option of determining that time using any method you choose. In what way is this insufficient for your use case?