Cron作业在60秒后以python 3.7在GAE上以504网关超时结束

时间:2018-11-24 13:55:04

标签: python google-app-engine cron

我使用python 3.7和django使用google template使用google app引擎创建了一个新项目。 所有cron作业均失败,请求超时504。另外,我尝试了新的任务队列 使用Google云任务,但此请求在60秒后也失败了。

App.yaml

User

Cron.yaml

protected $with = [ 'comments'];

function comments ()
{ 
    return $this->hasMany(Comments::class,  'user_id', 'id');
 }

定时视图

# [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

1 个答案:

答案 0 :(得分:1)

这只是一个理论:)

文档中似乎存在一些冲突。

一方面(来自第二代标准环境)Scheduling Jobs with cron.yaml

  

cron作业将使用HTTP GET请求在给定的URL上调用URL。   一天中的时间。 cron调用的HTTP请求最多可以运行60个   分钟,但为subject to the same limits as other HTTP requests

相比之下,对于第一代标准环境,来自Deadlines

  

cron超时期限取决于实例类和扩展   为您的应用配置的类型:

     

自动缩放

     

超时大约10分钟。

另一方面,来自Instance scaling表中的Deadline行(与the 1st generation信息一致,但鉴于任务队列支持is actually different,可能只是文档错误):

  

自动缩放

     

HTTP请求的最后期限为60秒,任务的最后期限为10分钟   排队任务。

...,当然,请记住cron请求是HTTP请求,而不是任务队列任务。

相关问题