Synchronization primitives for ndb tasklets on Google App Engine (GAE)
Project description
Inspired by pythons new asyncio, this package implements the most basic synchronization primitives to work with ndb’s tasklets for the Google AppEngine (GAE)
Install
pip install ndb-x
Usage
We have the three primitives Lock, Semaphore and BoundedSemaphore. Usage is, what you expect, straightforward:
from google.appengine.ext import ndb from ndbx.locks import Lock lock = Lock() @ndb.tasklet def work_async(): # using a context-manager will release the lock automatically with (yield lock.acquire()): rv = yield do_something_async() @ndb.tasklet def traditional_flow(): yield lock.acquire() try: # do something finally: lock.release()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ndb-x-0.0.1.zip
(8.2 kB
view details)
File details
Details for the file ndb-x-0.0.1.zip
.
File metadata
- Download URL: ndb-x-0.0.1.zip
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44727faa5778d9946f34e47d75fa2fca9eac0740dec77dbc7a900406080b8aaf |
|
MD5 | f41f0b2ab976c073d93ce35ce8396720 |
|
BLAKE2b-256 | 713e7b25ff5360a120f508cff33f2f6c08987ddd13d2dc0d9e8f85e45a9f408f |