Lightweight, asynchronous function execution in Python using AMQP. Provoke was inspired by Celery, but intends to be much smaller and less invasive.
sudo pip install provoke
The provoke
script manages a set of processes, each capable of pulling task
messages from an AMQP queue and executing them. The script uses an external
Python module, using setuptools Entry Points, to load the information
about processes and tasks.
To try it out, you will need a basic RabbitMQ broker running on localhost. When you're ready, start up the provoke worker with the worker example plugin:
provoke example
In another terminal, use the client example to send a task for execution:
python -m provoke.example.client
Try running the client example with some command-line arguments, and pay attention to the different PIDs running the tasks.
As easy as that, you have four processes executing a simple task!
Definitely check out the source code for the worker example and client example to see how it's done.
Start by creating a virtualenv in a clone of the repository:
virtualenv .venv
source .venv/bin/activate
Install the package in development mode. Note: Do not use sudo
!
python setup.py develop
Finally, install test dependencies and run py.test
:
pip install -r test/requirements.txt
pip install MySQL-python
py.test