Hi everyone, I am wondering if anyone has had succ...
# ask-community
g
Hi everyone, I am wondering if anyone has had success using the
rate_limit
function? I have set up a global concurrency limit of 100 with a .25 slot delay per second. I have tried several configurations but no matter what I continue seeing the "Orchestration API Limit Reached" warning in the Prefect Cloud UI.
n
hi @gperrone - quick silly question, is your rate limit activated? you should be able to toggle it in the UI
g
Hey @Nate thanks for the reply, I actually had a brain fart moment during this whole process, I was doing:
Copy code
@flow
def main():
  rate_limit("api-limit")
  task_futures = [task.submit() for task in tasks]
instead of
Copy code
@flow
def main():
for task in tasks:
  rate_limit("api-limit")
  task.submit()
It looks like the limit is being respected now 🙂
gratitude thank you 1
n
good to hear! catjam
g
Also side question, now that I have my flow efficiently interacting with the API... Is the number of active slots on the global concurrency limit supposed to go back down to 0? Looks like they are all filled up despite no flows currently running!
g
Hey @gperrone - i had dropped this for some time and i’ve seen you replied on a thread of mine with this question too. One question: Did you setup the tag for the task that needs the api-limit? The documentation is confusing and i didn’t get it that you had to run as a function rate limit? How this function looks like?
g
Hey @Guilherme Petris, I do have a concurrency limit configured as well and the tag is set up properly. Although the concurrency limit is sort of bottlenecked by the actual global rate limit, the concurrency slots never get filled up, so I do not see the use of using both at the moment...
g
Well, i do have my rate_limit setup on the task, it’s activated and everything and i’m still getting the “Orchestration API Limit Reached” It’s not making any sense
g
What are your values for limit, slot decay per second, and the
occupy
kwarg for the the
rate_limit
call? I found those 3 factors affect how often the API is hit.
g
Are you using anything in the flow definition for
task_runner=
?