For my data science project, I deployed a dash (flask) webapp on Google App Engine, which reads data from Google Cloud Storage (GCS) and then analyzes and visualizes it. The data in GCS is updated regularly. To make sure that the app would read updated data, I set the app python code to starts with:
df=read_gcs(bucket_name)
My app.yaml file is like this:
service: myapp
runtime: python37
instance_class: F4
env: standard
automatic_scaling:
min_idle_instances: 1
max_idle_instances: 1
default_expiration: "1m"
inbound_services:
- warmup
entrypoint: gunicorn -b 0.0.0.0:8080 main:server
After the new data is updated, App Engine still shows the instances with old data. Since I have min_idle_instances: 1
, this may be similar is to some old issues related to static file caching:
Any way to force reset of all cached static files on AppEngine?
CSS File Not Updating on Deploy (Google AppEngine)
The strange part is that if I keep on sending requests, it will also start new instances with empty figures, which appears to be broken. I don't fully understand this disturbing behaviour.
My question is why reading from GCS is not working as it should and why the app also fail to show visualizations on new instances. I would really appreciate any inputs to help me understand what is happening.
Currently my work around of this issue is to set up a cloud build using cloud scheduler to deploy the app when the data is updated, which seems a bit of an overkill but works very well. I followed the steps shown in the following medium post:
https://medium.com/google-cloud/scheduling-cloud-builds-24d821d5a3d2
Are there less overkill work arounds?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…