[Twisted-Python] Running CPU bound function concurrently in twisted

Chengi Liu chengi.liu.86 at gmail.com
Sun Jun 23 17:39:48 MDT 2019


Hi,
 I tried posting on SO, but havent been able to solve the problem.
https://stackoverflow.com/questions/56696562/running-long-blocking-calculations-in-parallel-in-twisted

I have a very noob question.

I have a function, which takes a second or two to process (CPU bounded) and
then there is a for loop which runs that for loop.. Lets take this example

def func(x):
     return x*x

res = [func(i) for i in range(20)]


Now, think of func being something complicated.. But the above is the idea.

How do I run this function concurrently/ simultaneously using twisted
framework.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20190623/95b7e660/attachment.html>


More information about the Twisted-Python mailing list