6 Jan 2009 knipknap   » (Journeyer)

Release: SpiffWorkQueue 0.1.0

Here is another initial release: SpiffWorkQueue is an asynchronous, multi-threaded queue. The following example shows how to execute two tasks in parallel. In the example, each task consists of a sequence of two actions:

from SpiffWorkQueue import WorkQueue, Sequence, Action

class MyAction(Action):
    def __init__(self, name):
        Action.__init__(self, name)

    def execute(self, lock, global_context, context):
        print "Hello world"

queue    = WorkQueue()
actions1 = [MyAction("one"),   MyAction("two")]
actions2 = [MyAction("three"), MyAction("four")]
queue.enqueue(Sequence(actions = actions1))
queue.enqueue(Sequence(actions = actions2))

queue.start()
while queue.get_length() > 0:
    pass
queue.shutdown()

Links:
Download
Project page
API documentation
Handbook (PDF)

Syndicated 2009-01-06 10:56:44 from Debain.org

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!