Answer the question
In order to leave comments, you need to log in
How to organize task queue in AppEngine?
It would seem a simple task, but I'm already banging my head against the wall. Backend machine, there is a method that executes a task one by one, and if the task queue is empty, terminates.
from google.appengine.api import taskqueue
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class Worker(webapp.RequestHandler):
def get(self):
q = taskqueue.Queue('pull-queue')
tasks = q.lease_tasks(3600, 1)
if len(a):
task = tasks[0]
# долгая работа с задачей
q.delete(task)
application = webapp.WSGIApplication([('/backend', Worker)])
q = taskqueue.Queue('pull-queue')
q.add(taskqueue.Task(payload=data, method='PULL'))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question