首页 > 解决方案 > 无法在我的 Google App Engine 服务器上下载 1.34GB 的文件

问题描述

我正在尝试在 Google App Engine 上下载预训练模型,但是当我尝试下载时,它只是不断重新启动下载过程。
我该如何防止呢?

A 2020-05-11T19:32:55Z [2020-05-11 19:32:55 +0000] [40] [INFO] Worker exiting (pid: 40)
A 2020-05-11T19:32:55Z 
Downloading:  66%|██████▌   | 885M/1.34G [00:27<00:14, 32.2MB/s]
A 2020-05-11T19:32:55Z [2020-05-11 19:32:55 +0000] [50] [INFO] Booting worker with pid: 50
A 2020-05-11T19:32:57Z Downloading files...
A 2020-05-11T19:32:57Z Downloaded bert tokenizer
A 2020-05-11T19:33:25Z 
Downloading:  69%|██████▊   | 921M/1.34G [00:27<00:11, 37.2MB/s][2020-05-11 19:33:25 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:50)
A 2020-05-11T19:33:25Z [2020-05-11 19:33:25 +0000] [50] [INFO] Worker exiting (pid: 50)
A 2020-05-11T19:33:25Z 
Downloading:  69%|██████▊   | 921M/1.34G [00:27<00:12, 33.8MB/s]
A 2020-05-11T19:33:26Z [2020-05-11 19:33:26 +0000] [60] [INFO] Booting worker with pid: 60
A 2020-05-11T19:33:27Z Downloading files...
A 2020-05-11T19:33:27Z Downloaded bert tokenizer
A 2020-05-11T19:33:56Z 
Downloading:  51%|█████     | 678M/1.34G [00:27<00:18, 36.2MB/s][2020-05-11 19:33:56 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:60) 
A 2020-05-11T19:33:56Z [2020-05-11 19:33:56 +0000] [60] [INFO] Worker exiting (pid: 60)
A 2020-05-11T19:33:56Z 
Downloading:  51%|█████     | 681M/1.34G [00:27<00:26, 25.0MB/s]
A 2020-05-11T19:33:56Z [2020-05-11 19:33:56 +0000] [70] [INFO] Booting worker with pid: 70
A 2020-05-11T19:33:57Z Downloading files...
A 2020-05-11T19:33:57Z Downloaded bert tokenizer

看看它是如何重复这个过程的,即使它还没有完成。
我认为这与工人退出有关,但我的规格很高

应用程序.yaml

runtime: python
env: flex
entrypoint: gunicorn -b :$PORT main:app
runtime_config:
    python_version: 3

# System specifications
manual_scaling:
    instances: 1
resources:
    cpu: 8
    memory_gb: 16
    disk_size_gb: 15

# Health checks 
liveness_check:
    path: "/liveness_check"
    initial_delay_sec: 600

如果我先将它上传到谷歌存储桶(在同一区域)然后从那里下载它会有帮助吗?

标签: google-app-enginegoogle-cloud-platform

解决方案


gunicorn 工人有 30 秒的超时时间。您可以通过将 app.yaml 文件更改为以下内容来增加它:

entrypoint: gunicorn -t (value in seconds) -b :$PORT main:app

但是,请注意 App Engine 是一种无服务器解决方案。这意味着每次旋转实例时,都必须在每个实例上下载这些文件,并且当实例死亡时,它的状态也会随之消失。


推荐阅读