GAE flex 默认使用 gunicorn 作为入口点,这很好,除了我有一个函数需要很长时间来处理(抓取网站和数据库中的故事数据)并且默认情况下 gunicorn 在 30 秒超时,然后是一个新工人从头开始执行任务,依此类推。
我可以将 gunicorn 超时设置为 20 分钟之类的时间,但这似乎并不优雅。有没有办法在 gunicorn 的“外部”运行这些后端功能,或者我没有考虑过的 gunicorn 配置?没有客户端,所以完成时间长不是问题。
我的app.yaml文件目前看起来像这样:
runtime: python
env: flex
entrypoint: gunicorn -b :$PORT main:app
runtime_config:
python_version: 2
# This sample incurs costs to run on the App Engine flexible environment.
# The settings below are to reduce costs during testing and are not appropriate
# for production use. For more information, see:
# https://cloud.google.com/appengine/docs/flexible/python/configuring-your app-with-app-yaml
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 3
disk_size_gb: …Run Code Online (Sandbox Code Playgroud)