Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding task to non-default queue in google app engine

I'm trying to add a task to non-default queue "slowQueue" using:

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

I receive the error "TypeError: add() got an unexpected keyword argument 'url'"

How do you add a task to a non-default queue in google app engine?

like image 962
Ajax Avatar asked Dec 16 '22 23:12

Ajax


2 Answers

You suppose to add task(s) when calling Queue.add()

q = taskqueue.Queue('slowQueue') 
task = taskqueue.Task(url='/worker/slow', params={'name': name})
q.add(task)
like image 160
Shay Erlichmen Avatar answered Dec 30 '22 11:12

Shay Erlichmen


Alternatively (to Shay's answer), if you prefer a shorter but less object oriented style:

taskqueue.add(queue_name='slowQueue', url='/worker/slow', params={'name': name})
like image 25
Peter McKenzie Avatar answered Dec 30 '22 09:12

Peter McKenzie