I need to build a (web) interface that lists the current state of jobs
that have been pushed into a variety of different queues (using
beanstalkc with python talking to beanstalkd). Right now, I'm able to
see everything that is blocked by doing something along the lines of:

    mq = beanstalkc.Connection()
    for tube in mq.tubes():
        mq.watch(tube)
    peeked = []
    try:
        while True:
            job = mesg_queue.reserve(timeout=5)
            if job is None:
                break
            peeked.append(job)
    finally:
        for job in peeked:
            job.release()
    return peeked

I would also like to know which jobs have already been grabbed by my
workers, but I don't see a good way to get this information. The
workflow the workers have is:
   reserve() a job
   bury it
   do the long running task associated with the job
   delete the job when done

Thus, all jobs that are being operated on at the current time should
be buried (although not all buried jobs are necessarily being actively
worked on). I know of peek_buried(), but all the peek* commands seem
to give me just the first item in the queue which is buried. I'm
considering setting up a new tube which my worker processes will write
into saying that they are now handling job X and finished with job X,
and a status process monitors that queue building a representation of
my current work queues. However, I was hoping there was a cleaner way.

Ideally, I'd like to be able to just peek() at every job in the queue
by iterating over the job ids. However, although there is a 'total-
jobs' which gives me the upper bound of the job range, there doesn't
seem to be a minimum job id for to use, and looping from 1 through all
job ids that have already been deleted seems like a very poor option.
If the server stats listed the minimum-job id on the server, this
would be a much simpler task that I could just mostly accomplish with
'peek()' and a loop.

  -- William
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"beanstalk-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/beanstalk-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to