Previous topic

Applications

Next topic

Internals

This Page

TasksΒΆ

A simple, yet flexible, distributed task queue library.

Inspired by Celery, this is a light-weight task queue which can be run on several parallel processes (only for Python version >= 2.6).

Tasks are created by subclassing unuk.contrib.tasks.Task and implementing the run method.:

from unuk.contrib.tasks import Task

class SumTask(Task):

    def run(task_name, task_id, logger, a, b):
        return a+b

There is an example of usage of the library in examples.taskqueue. To play with it, move into the examples directory and launch the server by typing:

python runexample.py taskqueue

On a new shell, move to the same directory and launch the python console. Then type:

>>> from taskqueue.application import proxy
>>> p = proxy()
>>> p.calculate(2,3)