Alex
Alex

Reputation: 1031

Python multiprocessing manager does not work in uwsgi for spawn method

Python multiprocessing manager does not work in uwsgi for spawn method in Linux. Code:

from torch.multiprocessing import Manager                                                                                                                    
import torch.multiprocessing as mp          
                                                                                                                                                       
        
if __name__ == 'uwsgi_file__home_kasha_uwsgi_test_test':
  ctx = mp.set_start_method('spawn')
  m = mp.Manager()
                                                                                                                                                     
            
def application(env, start_response):
  start_response('200 OK', [('Content-Type','text/html')])
  return [b"Hello World"]

Run:

uwsgi --ini ./test.ini

Error:

unable to load configuration from from multiprocessing.resource_tracker import main;main(9)
/usr/bin/uwsgi-core: unrecognized option '--multiprocessing-fork'

OS:

DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy DISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS"

If I set here ctx = mp.set_start_method('spawn') 'fork' it works.

test.ini:

[uwsgi]
master = true
processes = 1

socket = 127.0.0.1:9000
buffer-size=32768
#protocol = http-socket                                                                                                                                                     
socket = /home/kasha/uwsgi_test/test.sock
chown-socket = kasha:kasha

vacuum = true

die-on-term = true
plugins = python3
#logto = /home/kasha/uwsgi_test/err.log                                                                                                                                     

wsgi-file = /home/kasha/uwsgi_test/test.py
lazy = true
enable-threads = false

  

Upvotes: 0

Views: 75

Answers (0)

Related Questions