Alex Caruso
12/13/2024, 5:44 PMrate_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?Alex Caruso
12/13/2024, 5:44 PMAlex Caruso
12/13/2024, 5:45 PM2.15.0
Alex Caruso
12/13/2024, 5:45 PMMarvin
12/13/2024, 5:45 PMAlex Caruso
12/13/2024, 5:49 PMActive Slots
is even configurable - why would we ever set this to anything other than 0
at the outset?Nate
12/13/2024, 5:50 PMit is only ever occupying 1 active slot
rate_limit("task_throttle_test", occupy=1)
I think this is because you're setting occupy=1
Nate
12/13/2024, 5:50 PMI am also confused about why thethis is a good questionis even configurable - why would we ever set this to anything other thanActive Slots
at the outset?0
Alex Caruso
12/13/2024, 5:54 PMrate_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 thatAlex Caruso
12/13/2024, 5:59 PMrate_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 occupiedAlex Caruso
12/13/2024, 6:27 PM> I am also confused about why theis even configurable - why would we ever set this to anything other thanActive Slots
at the outset?0
this is a good questionFound the answer to this one here - https://github.com/PrefectHQ/prefect/issues/13361#issuecomment-2136009066
Alex Caruso
12/13/2024, 6:28 PM