I am using gevent and I am monkey patching everything.
It seems like the monkey patching causes the threading to work serially.
My code:
import threading
from gevent import monkey; monkey.patch_all()
class ExampleThread(threading.Thread):
def run(self):
do_stuff() # takes a few minutes to finish
print 'finished working'
if __name__ == '__main__':
worker = ExampleThread()
worker.start()
print 'this should be printed before the worker finished'
So the thread is not working as expected.
But if I remove the monkey.patch_all()
it is working fine.
The problem is that I need the monkey.patch_all()
for using gevent (now shown in the code above)
My solution:
I changed the
monkey.patch_all()
to
monkey.patch_all(thread=False)
so I am not patching the thread.