How to combine multiprocessing and eventlet

前端 未结 2 1484
甜味超标
甜味超标 2021-01-21 12:00

I have a task need to start 2 processes and within each process need to start 2 threads to do really work. Below is the source code I used to simulate my use case.



        
相关标签:
2条回答
  • 2021-01-21 12:36

    As of 2018-01, Eventlet and multiprocessing don't work well together. Your best option is to spawn worker processes externally. Second best option is os.fork() to create worker processes and only then import eventlet.

    Subscribe to this issue to be notified when multiprocessing compatibility is resolved. https://github.com/eventlet/eventlet/issues/147

    0 讨论(0)
  • 2021-01-21 12:38

    The main module should be importable for multiple process to work properly. Do not call main() in global space, use it like:

    if name == 'main': main()

    0 讨论(0)
提交回复
热议问题