Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
365 views
in Technique[技术] by (71.8m points)

flask - Google App Engine showing old cached instances or broken new instances for data science webapp (dash)

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...