A transaction-aware Celery job setup
Project description
===============================
Transactional Celery for Pyramid
===============================
.. image:: https://badge.fury.io/py/pyramid_transactional_celery.png
:target: http://badge.fury.io/py/pyramid_transactional_celery
.. image:: https://travis-ci.org/petrilli/pyramid_transactional_celery.png?branch=master
:target: https://travis-ci.org/petrilli/pyramid_transactional_celery
.. image:: https://pypip.in/d/pyramid_transactional_celery/badge.png
:target: https://pypi.python.org/pypi/pyramid_transactional_celery
A transaction-aware Celery job setup. This is integrated with the Zope
transaction_ package, which implements a full two-phase commit protocol.
While it is not designed for anything other than Pyramid, it also does not
use any component of Pyramid. It's simply not tested anywhere else.
* Free software: BSD license
* Documentation: https://pyramid_transactional_celery.readthedocs.org.
.. _transaction: https://pypi.python.org/pypi/transaction
Features
--------
* Queues tasks into a thread-local when they are called either using ``delay``
or ``apply_async``.
* If the transaction is aborted, then the tasks will never be called.
* If the transaction is committed, the tasks will go through their normal
``apply_async`` process and be queued for processing.
Limitations
-----------
Currently, the code is designed around Celery v3.1, and it is unknown whether
it will work with previous versions. I'm more than happy to integrate changes
that would make it work with other releases, but since I generally stay on
the latest release, it isn't a priority for my own development.
Usage
-----
Using the library is a relatively easy thing to do. First, you'll need to
integrate Celery into your Pyramid application, for which I recommend using
pyramid_celery_. Once that's done, you simply need to start creating your
tasks. The big difference is for function-based tasks, you use a different
decorator::
from pyramid_transactional_celery import task_tm
@task_tm
def add(x, y):
"""Add two numbers together."""
return x + y
That's all there is to it. For class-based tasks, you simply need to
subclass ``TransactionalTask`` instead of ``Task``::
from pyramid_transactional_celery import TransactionalTask
class SampleTask(TransactionalTask):
"""A sample task that is transactional."""
def run(x, y):
return x + y
That's it. Bob's your uncle.
.. _pyramid_celery: https://pypi.python.org/pypi/pyramid_celery/
History
-------
0.1.0 (2015-01-19)
---------------------
* Initial functionality, but more testing of edge cases is needed to ensure
that it works correctly in all cases, and with other versions of Celery.
* First release on PyPI.
Transactional Celery for Pyramid
===============================
.. image:: https://badge.fury.io/py/pyramid_transactional_celery.png
:target: http://badge.fury.io/py/pyramid_transactional_celery
.. image:: https://travis-ci.org/petrilli/pyramid_transactional_celery.png?branch=master
:target: https://travis-ci.org/petrilli/pyramid_transactional_celery
.. image:: https://pypip.in/d/pyramid_transactional_celery/badge.png
:target: https://pypi.python.org/pypi/pyramid_transactional_celery
A transaction-aware Celery job setup. This is integrated with the Zope
transaction_ package, which implements a full two-phase commit protocol.
While it is not designed for anything other than Pyramid, it also does not
use any component of Pyramid. It's simply not tested anywhere else.
* Free software: BSD license
* Documentation: https://pyramid_transactional_celery.readthedocs.org.
.. _transaction: https://pypi.python.org/pypi/transaction
Features
--------
* Queues tasks into a thread-local when they are called either using ``delay``
or ``apply_async``.
* If the transaction is aborted, then the tasks will never be called.
* If the transaction is committed, the tasks will go through their normal
``apply_async`` process and be queued for processing.
Limitations
-----------
Currently, the code is designed around Celery v3.1, and it is unknown whether
it will work with previous versions. I'm more than happy to integrate changes
that would make it work with other releases, but since I generally stay on
the latest release, it isn't a priority for my own development.
Usage
-----
Using the library is a relatively easy thing to do. First, you'll need to
integrate Celery into your Pyramid application, for which I recommend using
pyramid_celery_. Once that's done, you simply need to start creating your
tasks. The big difference is for function-based tasks, you use a different
decorator::
from pyramid_transactional_celery import task_tm
@task_tm
def add(x, y):
"""Add two numbers together."""
return x + y
That's all there is to it. For class-based tasks, you simply need to
subclass ``TransactionalTask`` instead of ``Task``::
from pyramid_transactional_celery import TransactionalTask
class SampleTask(TransactionalTask):
"""A sample task that is transactional."""
def run(x, y):
return x + y
That's it. Bob's your uncle.
.. _pyramid_celery: https://pypi.python.org/pypi/pyramid_celery/
History
-------
0.1.0 (2015-01-19)
---------------------
* Initial functionality, but more testing of edge cases is needed to ensure
that it works correctly in all cases, and with other versions of Celery.
* First release on PyPI.
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
Built Distribution
Close
Hashes for pyramid_transactional_celery-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9ac370221bde2c0f7d1502516d836b797b0e9cc94d1d8292ff4ade6e42d9506 |
|
MD5 | ba54ddd308164caf5ae9b2c7ef58de10 |
|
BLAKE2b-256 | bad6bc52a7db15b0c3f7d28c28a9aa1c2d5a42c8a4077432ffe103d6f8b6f200 |
Close
Hashes for pyramid_transactional_celery-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02ed09cfb42153b58246124bc3346b5989a105a838da498d0c80a55ab3232851 |
|
MD5 | 9cce037bcbf28471c88ee21fd8c46825 |
|
BLAKE2b-256 | b09b0ac36eb5a1e295bf47e0658aeb4213a2fba66bab0221d9ada3cf31e30cd9 |