Implementing fixed-size tasks pool #2213
Unanswered
AndreiPashkin
asked this question in
Q&A
Replies: 1 comment 7 replies
-
Take a look and see if any of the suggestions on this thread work: #596. The code samples are primarily in C# or JavaScript, but in theory the same approach should work for Python. Adding @davidmrdavid in case he has any thoughts about the |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I'm trying to implement the pool pattern which would process a fixed amount of tasks at a time. Basically a more advanced alternative to
task_all()
that would not launch all the tasks at once but process them gradually, ensuring that onlyN
amount of tasks are launched at once. The exact problem that I'm trying to solve are OOM errors that we are getting when we schedule all the tasks withtask_all()
at once.I thought that I could employ
task_any()
to check for completion of individual tasks and dequeue them but it turned out that repeated calls totask_any()
on the same tasks lead to an exception like that:And it seems that there is no other way to get the status of an existing task - so there is no way to monitor it and remove from the pool. So I'm stuck because of that.
I wonder if anyone could kindly provide any pointers? Maybe I'm just doing it wrong and this is not how concurrency limiting should be done in AZ Functions? Or maybe there is a way to implement pooling?
To be more specific, here are my questions:
p.s.
I'm also aware of batching technique when
task_all()
is used on small batches of tasks - but it's not very efficient.Beta Was this translation helpful? Give feedback.
All reactions