How to install gaedeferred
- Download and install ActivePython
- Open Command Prompt
- Type
pypm install gaedeferred
Lastest release
What's this
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.
How to
Follow steps.:
>>> 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.:
$ nosetests
Or:
$ python setup.py test
To test, this module requires nose and some modules.
- nose
- NoseGAE
- gaetestbed
https://github.com/jgeewax/gaetestbed with a patch. https://github.com/jgeewax/gaetestbed/pull/10 - WebTest - docutils
Note, they will be installed automatically when you run "python setup.py test".
To do
- Consider transaction control of DeferredList doing.
Questions and Bug Reports
- Site
https://github.com/jbking/gaedeferred
- Or, cantact me.
MURAOKA Yusuke <yusuke@jbking.org>
Changes
0.2.1
- 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.
0.2
- Added DeferredList.
- Made tests robust by changing test runner to nose
with NoseGAE and gaetestbed. - Some bugs fixed. - Moved developping repository to github.
0.1
- Incompatible API change between 0.1dev to 0.1.
It was my misunderstanding of Twisted deferred.