尝试使用它们会给我以下错误:
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
gunicorn.conf.py
# 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期间,所以我认为应用程序定义上下文不会有用。但是为了完整起见,我正在启动一个基本的flask应用程序。像这样:
my_project / server.py
from flask import Flask
from my_project.handlers import run
app = Flask(__name__)
app.register_blueprint(run, url_prefix='/run')
答案 0 :(得分:0)
我有同样的错误。我想如果要使用 gevent ,我们仅限于 GAE Flexible 或 GKE上的Cloud Run 。
GAE Standard 在沙盒(gVisor)中运行,并且某些操作受到限制(我注意到此尝试的 Cloud Run 与存在相同的问题> gevent )
您看到的错误是这个:
Container Sandbox Limitation: Unsupported syscall
getsockopt(0x5,0x1,0x26,0x7e11bd8ddf20,0x7e11bd8ddf24,0x4)