https://github.com/kaste/deferred2
Successor of the deferred library on google app engine
https://github.com/kaste/deferred2
app-engine google-appengine
Last synced: 16 days ago
JSON representation
Successor of the deferred library on google app engine
- Host: GitHub
- URL: https://github.com/kaste/deferred2
- Owner: kaste
- License: mit
- Created: 2016-12-26T21:25:36.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-10T11:14:01.000Z (about 9 years ago)
- Last Synced: 2025-02-21T14:50:02.026Z (11 months ago)
- Topics: app-engine, google-appengine
- Language: Python
- Homepage:
- Size: 26.4 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
Successor of the so useful deferred library on Google AppEngine (GAE).
It should fix some issues.
It should work async.
Usage
=====
By example::
from google.appengine.ext import ndb
import deferred2 as deferred
def work(message):
pass
@ndb.tasklet
def defer_one_task():
yield deferred.defer_async(work, 'to be done')
@ndb.tasklet
def defer_multiple_tasks():
yield deferred.defer_multi_async(
deferred.task(work, 'Hello'),
deferred.task(work, 'world!'))
@ndb.tasklet
def defer_deferring():
# this one enqueues one task right now, which will then add all the
# other tasks
yield deferred.one_shot_async(
deferred.task(work, 'Hello'),
deferred.task(work, 'world!'))
You see, it pretty much looks and works as before.
Changes
=======
- ``transactional``'s new default is ``auto`` (instead of ``False``), t.i. if your inside a transaction it will be set to True, otherwise it will be False
- You can set ``_urlsuffix`` which can be a str or a sequence of strs; which will get appended to the url. Pure cosmetics.
- In case you set a ``name`` that is too long or contains invalid characters, a hash of the name will be used instead.