This is my worker script code worker.py
:
def app():
# do some stuff
threads = []
t = threading.Thread(target = some_method, args = (1,2))
threads += [t]
t.start()
for t in threads:
t.join()
if I run it like so :
phython worker.py
it works. But if I run it like so : gunicorn -c gunicorn_config.py worker:app
It's stuck in the threads section. The threads are downloading images so I rather do in parallel.
my config is like so :
worker_class = 'sync'
worker_connections = 1000
timeout = 360
keepalive = 2
#This is the nuclear option. will print everything to log
spew = False
daemon = False
pidfile = 'master.pid'
umask = 0
user = None
group = None
tmp_upload_dir = None
logfile = 'log_tmp.log'
errorlog = '-'
loglevel = 'info'
accesslog = '-'
proc_name = 'GenericGunicorn'
# 0 is unlimited
limit_request_line = 0
my questions are:
- how can i solve that? make the threads work?
- if I can't, why should I use to run multiple worker processes on one machine ?
gunicorn
from in ainfinite Loop(Once)
You want some update/changes on default serving butwhich thread holding your external threads ?(None !)