txinvoke
Run inline callbacks from Twisted as Invoke tasks.
Installation
pip install txinvoke
Example
# -*- coding: utf-8 -*-
# tasks.py
import time
import txmongo
from txinvoke import task_on_callbacks
@task_on_callbacks(name='test_task')
def example(verbose=False):
connection = yield txmongo.MongoConnection()
test_collection = connection.db.test
for x in range(10000):
data = x * time.time()
doc = {'something': data}
yield test_collection.insert(doc, safe=True)
if verbose:
print("Test data '{data}' was inserted".format(data=data))
Caveats
Sorry, but tasks chaining will NOT work currently.
Metadata
Release files for txinvoke 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| txinvoke-0.1.0.tar.gz | 3.9 kB | Details |
Release files / txinvoke-0.1.0.tar.gz
| Download URL | txinvoke-0.1.0.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb75f294a8f3a9febfd2dc917c9966d9e326313a538a2ceded6bbea71be5013f
|
|
BLAKE2b-256 checksum How to use checksums |
f0a089bf19694704a9604f52bb15df8959fceaf80a446a2fa43db1080e1b86d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |