How to install gaedeferred
- Download and install ActivePython
- Open Command Prompt
pypm install gaedeferred
gaedeferred is a module to make deferred chain on Google Appengine. By lack of taskqueue API and ext.deferred design, there is no support for error case handling as errback and for collecting task result.
This module is inspired by Twisted.
>>> from google.appengine.ext import deferred >>> from gaedeferred import Deferred
>>> from tests.test_deferred import increase, must_be
>>> d = Deferred()
You can regist a callback and use alias. >>> d.addCallback(increase, 10).next(must_be, 15) # doctest: +ELLIPSIS <gaedeferred.deferred.Deferred object at ...>
The deferred chain is to be executed in an asynchronous task. So the function increase will be called with params 5 and 10 later. >>> deferred.defer(d.callback, 5) # doctest: +ELLIPSIS <google.appengine.api.taskqueue.taskqueue.Task object at ...>
More details, see tests. Also it has how to use DeferredList.
How to test
Use nose with NoseGAE.:
$ python setup.py test
To test, this module requires nose and some modules.
Note, they will be installed automatically when you run "python setup.py test".
- Consider transaction control of DeferredList doing.
Questions and Bug Reports
- Or, cantact me.
MURAOKA Yusuke <firstname.lastname@example.org>
- Fixed a behaviour of DeferredList failing case.
- Supports lack of a style callback chain.
Deferred(...).next(...).next(...).addBoth(...) - consumeError of DeferredList is now default True. - DeadlineExceededError should not be catched in Deferred default. You can still avoid this behaviour change by defining _raise_exception_types.
- Added DeferredList.
- Made tests robust by changing test runner to nose
with NoseGAE and gaetestbed. - Some bugs fixed. - Moved developping repository to github.
- Incompatible API change between 0.1dev to 0.1.
It was my misunderstanding of Twisted deferred.