Search code examples
google-api-python-clientgoogle-cloud-rungoogle-cloud-build

Migration to Google Cloud Run times out on grpcio


I had a Python program running in Google Cloud Run to which I just added Google Stackdriver logging capabilities. The program runs fine on my local machine and properly logs to Stackdriver. However, when I try to deploy the program to Google Cloud Run, the build times-out when installing grpcio. Here are some of the messages I see...

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

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

The second message just keeps repeating until the build times-out after about 10 minutes. My requirements.txt file is as follows...

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

Any thoughts on what's happening and how I can fix it? Thanks!


Solution

  • OK, it turns out that sometimes the best answer is the easiest one. Cloud Build was, indeed, timing out so all we had to do was to increase the amount of time it runs before timing out. This is done in the Build Configuration trigger YAML file by adding the following parameter (Cloud Build -> Triggers -> Build Configuration -> Inline)...

    timeout: 1200s
    

    I also added a line to my Dockerfile that may or may not be part of the solution (I haven't had a chance to see what happens if I try to run without this line)

    RUN apk add --no-cache linux-headers