我使用Python3.7使用google app engine创建了一个新项目,并使用google template创建了django。所有cron作业均失败,504请求超时。此外,我使用google cloud tasks尝试了新的任务队列,但这个请求在60秒后也失败了。
App.yaml
# [START django_app]
runtime: python37
handlers:
- url: /assets
static_dir: assets/
- url: /.*
script: auto
instance_class: F2
automatic_scaling:
min_idle_instances: 1
max_idle_instances: automatic
Cron.yaml
cron:
- description: cron eth price
url: /cron/
schedule: every 5 mins
Cron视图
class CronView(View):
def get(self, request, *args, **kwargs):
from time import sleep
sleep(240)
return HttpResponse('')
发布于 2018-11-24 15:34:43
这只是一个理论:)
文档中似乎有一点冲突。
一方面来自(第二代标准环境) Scheduling Jobs with cron.yaml
cron作业将在一天中的给定时间使用HTTP请求调用
。cron调用的HTTP请求最长可运行60分钟,但为subject to the same limits as other HTTP requests。
相比之下,对于第一代标准环境,来自Deadlines
cron超时期限取决于为您的应用配置的实例类和伸缩类型:
自动缩放
超时时间约为10分钟。
另一方面,来自Instance scaling表中的Deadline
行(与the 1st generation信息一致,但可能只是一个文档错误,因为任务队列支持is actually different):
Automatic scaling
HTTP请求60秒截止时间,任务队列任务10分钟截止时间。
..。当然,要记住cron请求是HTTP请求,而不是任务队列任务。
https://stackoverflow.com/questions/53458853
复制相似问题