Tinker
Tinker

Reputation: 4545

Appengine Push Queue Task Status

I am adding a long running task to Appengine's Push Queue. I would then like to redirect my user to a status page which upon refreshing will tell the user how many chunks of the task has been completed.

Aside from using an external datastore to keep track of the task's progress, what are my options?

(I don't see any documentation on Task or retrieving it in another view. The only thing I have found online is this SO answer from 3 years ago: Checking status of Task Queue in Google App Engine)

Upvotes: 1

Views: 515

Answers (1)

Bardia D.
Bardia D.

Reputation: 693

Other than datastore, you could:

  1. Keep a counter in memcache for each chunk of work and a total number of chunks counter, that way you know that 2 of 4 = 50% completed.
  2. Use Pipelines which can deliver a lot more information around the progress of asynchronous work on App Engine. https://code.google.com/p/appengine-pipeline, or the Getting Started guide is at https://code.google.com/p/appengine-pipeline/wiki/GettingStarted.
  3. Push queues aren't that great at providing status of running task completion. You could consider moving to Pull queues, and split all the units of work up into separate pull queue tasks. Pull queues have an experimental feature where you can tag the item, perhaps with the user id, and you can query the Pull queue items by a tag (https://developers.google.com/appengine/docs/python/taskqueue/overview-pull#Python_Leasing_tasks to understand how many items are leased or pending.

Upvotes: 2

Related Questions