Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A python library for the kestrel queue system
Python
branch: master
Failed to load latest commit information.
kestrel A little code cleanup
.gitignore Import
LICENSE Import
README.mkd updated readme
setup.py prep 0.5.1
tests.py go back to allowing multiple servers

README.mkd

A Python Kestrel library

This is a simple client library for the kestrel queue system. It supports the entire documented protocol.

This library extends the Client class in the python-memcached library to add support for the non-memcache calls that kestrel supports like: config, reload, and shutdown.

WARNING!!!

You should only send strings through to the queue, if not the python-memcached library will serialize these objects and since kestrel ignores the flags supplied during a set operation, when the object is retrieved from the queue it will not be unserialized.

Examples

Adding an job to the queue:

import kestrel

q = kestrel.Client(servers=['127.0.0.1:22133']) q.add('test_queue', 'some test job') q.close() # disconnect the client

Read a job from the queue:

job = q.get('test_queue')

Peek at the next job in line:

job = q.peek('test_queue')

Reliably read a set of jobs from the queue:

while True:
    job = q.next('test_queue', timeout=10) # marks the last job as complete and gets a new one, also waits 10 seconds if no jobs are currently in the queue
    if job is not None:
        try:
            #process job
        except:
            q.abort('test_queue') # mark the job as failed.

q.finish('test_queue') # mark the last job a complete

Something went wrong with that request. Please try again.