迁移到 Google Cloud 运行 在 grpcio 上超时

Migration to Google Cloud Run times out on grpcio

我在 Google Cloud 运行 中有一个 Python 程序 运行,我刚刚添加了 Google Stackdriver 日志记录功能。该程序在我的本地机器上运行良好,并正确登录到 Stackdriver。但是,当我尝试将程序部署到 Google Cloud 运行 时,安装 grpcio 时构建超时。这是我看到的一些消息...

Step #0 - "Build": Running setup.py install for grpcio: started

Step #0 - "Build": Running setup.py install for grpcio: still running...

第二条消息一直重复,直到大约 10 分钟后构建超时。 我的requirements.txt文件如下...

SQLAlchemy~=1.3.2
Werkzeug~=1.0.1
MarkupSafe~=1.1.1
WTForms~=2.3.1
python-dateutil~=2.8.1
Flask~=1.1.2

grpcio~=1.34.0
google-cloud-logging~=2.0.2

对发生的事情有什么想法以及我该如何解决?谢谢!

好的,事实证明有时候最好的答案是最简单的。 Cloud Build 确实会超时,所以我们所要做的就是增加超时前的 运行 秒。这是通过添加以下参数在构建配置触发器 YAML 文件中完成的(Cloud Build -> Triggers -> Build Configuration -> Inline)...

timeout: 1200s

我还在我的 Dockerfile 中添加了一行,它可能是解决方案的一部分,也可能不是解决方案的一部分(我还没有机会看到如果我尝试 运行 没有这一行会发生什么)

RUN apk add --no-cache linux-headers