hi all, has anyone successfully implemented the ta...
# ask-community
a
hi all, has anyone successfully implemented the task submission throttling example using
rate_limit()
here? I can't seem to get this working as expected . . . My concurrency limit configs are below. In my case I want to submit 30 tasks per second, so I assume I should set the concurrency limit to
30
and also the
slot_decay_per_second
to
30
- this way, each second 30 tasks get submitted, and 30 slots are filled and released However no matter what combination of configs I try, it is only ever occupying 1 active slot (I can see this in the UI when I refresh the page), so it's throttling it to 1 task submission per second. I may be misunderstanding the docs, they are bit confusing. It's definitely doing the rate limiting . . . (without
rate_limit()
it just submits all the tasks at once) - but it's limiting much more than I would expect given my config. Any ideas?
image.png
I am using prefect version
2.15.0
@Marvin am I misconfiguring my concurrency limit here?
m
To help you determine if there's a misconfiguration in your concurrency limit, I'll need to check the Prefect version you're using. Could you let me know whether it's Prefect 2.x or 3.x? If you're unsure, you can tell me some details about how you've set it up or any error messages you might be receiving, and I can infer from that. Once I have that information, I'll search the relevant documentation and GitHub issues to provide more specific guidance.
a
I am also confused about why the
Active Slots
is even configurable - why would we ever set this to anything other than
0
at the outset?
n
it is only ever occupying 1 active slot
Copy code
rate_limit("task_throttle_test", occupy=1)
I think this is because you're setting
occupy=1
I am also confused about why the
Active Slots
is even configurable - why would we ever set this to anything other than
0
at the outset?
this is a good question
a
>> it is only ever occupying 1 active slot >
Copy code
rate_limit("task_throttle_test", occupy=1)
> I think this is because you're setting
occupy=1
This is the default value, but also this makes sense to me - each task should occupy 1 slot. But on the next iteration of the loop, the next task isn't getting submitted and occupying a second slot, even though there are more active slots available. Instead it's waiting for the first to be released then occupying that
My understanding is that the call to
rate_limit()
should block execution only if the number of active slots is equal to the concurrency limit. But it seems in my case that it's blocking even if there are free slots that can be occupied
> I am also confused about why the
Active Slots
is even configurable - why would we ever set this to anything other than
0
at the outset?
this is a good question
Found the answer to this one here - https://github.com/PrefectHQ/prefect/issues/13361#issuecomment-2136009066
but still stuck on the main behavior unfortunately, it just seems that I'm not able to occupy more than 1 slot no matter how I configure the limit and slot decay etc