简体   繁体   English

在Google应用引擎中将任务添加到非默认队列

[英]adding task to non-default queue in google app engine

I'm trying to add a task to non-default queue "slowQueue" using: 我正在尝试使用以下命令将任务添加到非默认队列“slowQueue”:

taskqueue.Queue('slowQueue').add(url='/worker/slow', params={'name': name})

I receive the error "TypeError: add() got an unexpected keyword argument 'url'" 我收到错误“TypeError:add()得到一个意外的关键字参数'url'”

How do you add a task to a non-default queue in google app engine? 如何将任务添加到谷歌应用引擎中的非默认队列?

You suppose to add task(s) when calling Queue.add() 你想在调用Queue.add()时添加任务

q = taskqueue.Queue('slowQueue') 
task = taskqueue.Task(url='/worker/slow', params={'name': name})
q.add(task)

或者(对Shay的回答),如果你喜欢更短但更少面向对象的风格:

taskqueue.add(queue_name='slowQueue', url='/worker/slow', params={'name': name})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM