Good morning. Is there a way to schedule foreach s...
# ask-metaflow
c
Good morning. Is there a way to schedule foreach step to be executed one per day to avoid hitting api limit (using step functions)? Thank you very much 🙏
1
v
you could schedule a flow to be executed once per day. You could use the client API to inspect what data exists and continue processing incrementally, hence simulating what foreach does
what API limit are you hitting?
c
google search 10000 per day for example. So I want to stretch out a foreach loop over 50 files with 1k+ docs each over 10 days so I don't have to submit 50 runs with one file each or something like that.
v
ah, I see. You can do
step-functions create --max-workers 1
to make sure only one foreach task is run at a time, i.e. limit concurrency
if even one task is too fast, you can add a delay between API requests to make sure you stay within limits
c
Ok. Great 👍
v
let us know if that doesn't do the trick