gcloud app.yaml Python 资源设置

gcloud app.yaml Python setting for resources

我们如何在 app.yaml 中为 Python 运行时设置资源? 当它到达资源部分时,下面给我一个错误。但是,如果我选择 nodejs14 作为运行时,它就可以工作

runtime: python27
api_version: 1
threadsafe: true

manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 1
env_variables:
  NODE_ENV: 'production'

2 flavors of App Engine:标准;弹性

使用标准 app.yaml 中没有资源部分,因为资源由实例类型决定。

https://cloud.google.com/appengine/docs/standard/nodejs/config/appref

使用 flex,resources 部分用于确定(Compute Engine)VM 类型。

https://cloud.google.com/appengine/docs/flexible/python/reference/app-yaml#resource-settings

如果您希望使用标准并指定资源,则需要指定实例类型:

https://cloud.google.com/appengine/docs/standard#instance_classes

如果您希望使用 flex,可以使用 resources 部分指定 CPU 和内存。