gaetk2.tools.taskqueue - access App Engine taskqueues¶
This are convinience functions to work with App Engine taskqueues.
Also defer()
provides much better error reporting
See Error Handling Guide.
Module contents¶
-
gaetk2.taskqueue.
taskqueue_add_multi
(qname, url, paramlist, **kwargs)[source]¶ Adds more than one Task to the same Taskqueue/URL.
This helps to save API-Calls. Usage pattern:
tasks = [] for kdnnr in kunden.get_changed(): tasks.append(dict(kundennr=kdnnr)) taskqueue_add_multi('softmq', '/some/path', tasks)
-
gaetk2.taskqueue.
taskqueue_add_multi_payload
(name, url, payloadlist, **kwargs)[source]¶ like taskqueue_add_multi() but transmit a json encoded payload instead a query parameter.
In the Task handler you can get the data via
zdata = json.loads(self.request.body)
. See http://code.google.com/appengine/docs/python/taskqueue/tasks.html
-
gaetk2.taskqueue.
defer
(obj, *args, **kwargs)[source]¶ Defers a callable for execution later.
like https://cloud.google.com/appengine/articles/deferred but adds the function name to the url for easier debugging.
- Add this to app.yaml:
- handlers:
# needed to allow abritary postfixes and better error handling - url: /_ah/queue/deferred(.*)
script: gaetk2.views.default.application login: admin