这是我的工作人员脚本代码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()
如果我像这样运行它:
phython worker.py
它有效。但如果我像这样运行它: gunicorn -c gunicorn_config.py worker:app
它被困在线程部分。线程正在下载图像,所以我宁愿并行处理。
我的配置是这样的:
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
我的问题是: