试图使用它们会给我以下错误:
Traceback (most recent call last):
File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/env/lib/python3.7/site-packages/gunicorn/workers/ggevent.py", line 196, in init_process
self.patch()
File "/env/lib/python3.7/site-packages/gunicorn/workers/ggevent.py", line 75, in patch
fileno=s.sock.fileno()))
File "/env/lib/python3.7/site-packages/gevent/_socket3.py", line 114, in __init__
self._sock = self._gevent_sock_class(family, type, proto, fileno)
OSError: [Errno 92] Protocol not available: 'protocol'
python 3环境中不支持套接字吗?这是不起作用的原因吗?
我的应用程序在其他Web服务器上花费了大量时间,因此使用异步工作程序是获得良好性能所必需的。与此同时,我将尝试使用eventlet
工作人员。
编辑:包括更多关于使用的上下文
的app.yaml
runtime: python37
instance_class: F2
entrypoint: gunicorn -c gunicorn.conf.py -b :$PORT my_project.server:app
个unicorn.conf.朋友
# Recommended number of workers based on instance size:
# https://cloud.google.com/appengine/docs/standard/python3/runtime#entrypoint_best_practices
workers = 2
# Use an asynchronous worker as most of the work is waiting for websites to load
worker_class = 'gevent'
由于它是在gunicorn启动期间,我不相信应用程序定义上下文会有用。但是为了完整性,我正在推出一个基本的烧瓶应用程序。就像是:
MY_PROJECT / server.py
from flask import Flask
from my_project.handlers import run
app = Flask(__name__)
app.register_blueprint(run, url_prefix='/run')
我有同样的错误。如果我们想使用gevent,我认为我们仅限于GAE上的GAE Flexible或Cloud Run。
GAE Standard在沙盒中运行(gVisor),有些操作有限(我注意到这个尝试Cloud Run与gevent有同样的问题)
你看到的错误是这个:
Container Sandbox Limitation: Unsupported syscall
getsockopt(0x5,0x1,0x26,0x7e11bd8ddf20,0x7e11bd8ddf24,0x4)