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()
Metadata
Release files for ndb-x 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ndb-x-0.0.1.zip | 8.2 kB | Details |
Release files / ndb-x-0.0.1.zip
| Download URL | ndb-x-0.0.1.zip |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44727faa5778d9946f34e47d75fa2fca9eac0740dec77dbc7a900406080b8aaf
|
|
BLAKE2b-256 checksum How to use checksums |
713e7b25ff5360a120f508cff33f2f6c08987ddd13d2dc0d9e8f85e45a9f408f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |