https://prefect.io logo
#prefect-community
Title
# prefect-community
n

Naga Sravika Bodapati

05/25/2022, 1:13 PM
Is there a way to set the start time of a IntervalClock for a flow using an input parameter?
a

Anna Geller

05/25/2022, 1:16 PM
What's your use case? Why would you want to do it this way?
n

Naga Sravika Bodapati

05/25/2022, 1:17 PM
dockerize flows and trigger them from one parent flow.
a

Anna Geller

05/25/2022, 1:25 PM
how is the parametrization of scheduled start_time relevant here? it may sound like a dumb question, but I don't see the connection here
interval schedules are generally meant to be running every X, say every 15 minutes - I would like to understand why parametrizing the start time would matter here given it runs on a regular interval anyway
n

Naga Sravika Bodapati

05/25/2022, 1:26 PM
We have to start 150 flows with batches of 10 each and 10mins apart
a

Anna Geller

05/25/2022, 1:30 PM
so the problem is batching and limiting concurrency?
n

Naga Sravika Bodapati

05/25/2022, 1:31 PM
yes
Copy code
clock_1 = IntervalClock(timedelta(minutes=10),
                        start_date=datetime.now(ist),
                        parameter_defaults={'Frequency':'Start_At_0'})

clock_2 = IntervalClock(timedelta(minutes=10),
                        start_date=datetime.now(ist) + timedelta(minutes=15),
                        parameter_defaults={'Frequency':'Start_At_15'})
can i use something like this?
for the parent flow?
a

Anna Geller

05/25/2022, 1:41 PM
Nice, I'm so glad we identified the actual problem here. Using parameters is not a good solution here - instead, it would be better if you set a concurrency limit for this flow - check this page
n

Naga Sravika Bodapati

05/25/2022, 1:42 PM
thanks anna, will check
a

Anna Geller

05/25/2022, 1:43 PM
to explain why: even if we define the parameters to start the first run at a given time using a parametrized start_date, the interval clock will keep spinning up new flow runs every 10 minutes for each of those clocks, which doesn't solve your actual problem of queueing the "too many" runs - but concurrency limits will help
n

Naga Sravika Bodapati

05/25/2022, 1:45 PM
yeah, makes sense!
👍 1
Will try this out Anna 🙂
🙌 1
3 Views