我正在使用 python Google App 引擎 SDK 和 Django 框架。在我的情况下,任务队列正在抛出截止日期超出错误
DeadlineExceededError:超过响应 HTTP 请求的总期限。
尽管在基本扩展中使用任务队列以及在基本或手动扩展中使用doc任务最多可以运行 24 小时。
任务正在更新所有 MySQL 数据库值,因此非常耗时。
通过发送 post 请求来启动任务
@api_view(['POST'])
def post_url(request):
params= dict(.......)#some dict
taskqueue.add(url='/tasks/gcm/gcm_all_user/',
params=params,
method="POST")
return Response('Initiated task')
此任务由 dispatch.yaml 分派到基本扩展模块
dispatch:
- url: "*/tasks/*"
module: tasks
任务模块有一个 url 处理程序
application: some-application
module: tasks
version: 2
runtime: python27
api_version: 1
threadsafe: true
basic_scaling:
libraries:
- name: MySQLdb
version: "latest"
handlers:
- url: /tasks.*
script: app.wsgi.application
任何人都可以告诉如何使任务运行更长时间而不会超过截止日期错误。