Commit Graph

51 Commits

Author SHA1 Message Date
Vincent Driessen a905961f94 Add some sample scripts. 2011-11-18 01:44:28 +01:00
Vincent Driessen a029e5437b Add beginnings of a rqworker script. 2011-11-18 00:51:34 +01:00
Vincent Driessen d780c929c0 Change semantics of work(). Add work_burst().
work() will now start the worker run loop, and work_burst() now leads to
the burst-then-quit behaviour.
2011-11-17 22:39:53 +01:00
Vincent Driessen d761dd0280 Add BSD license, copied from git-flow. 2011-11-17 15:22:47 +01:00
Vincent Driessen a491ff248d Add simple helper function, to avoid users to learn about the `conn`
stack.

This makes it easier to start using the product.
2011-11-17 13:29:32 +01:00
Vincent Driessen 0ff2984adf Use __slots__, for minimal memory overhead. 2011-11-16 19:12:19 +01:00
Vincent Driessen ced001cbb9 Update README with some project values. 2011-11-16 00:53:56 +01:00
Vincent Driessen 56c4445bb2 Shut up pyflakes. 2011-11-16 12:46:25 +01:00
Vincent Driessen b5ea5f32fe Variable renamed. 2011-11-16 12:46:10 +01:00
Vincent Driessen 8852859fc4 Improved the __repr__ and __str__ of Queues. 2011-11-16 12:45:59 +01:00
Vincent Driessen b4c1c85276 Add equality and comparison methods. 2011-11-16 12:45:16 +01:00
Vincent Driessen a5ea45af57 Make the dequeue methods return values consistent.
I merely refactored the internal calls. No external API changes have been made in this commit. In order to make the dequeueing methods consistent, each dequeue method now returns a Job instance, which is just a nice lightweight wrapper around the job tuple.

The Job class makes it easier to pass the method call info around, along with some possible meta information, like the queue the job originated from.

This fixes #7.
2011-11-16 12:44:33 +01:00
Vincent Driessen f492a5ae2b Restructure some code.
No functional change, but leave the BLPOP'ing to the Queue, as the
queues know how to pop themselves.
2011-11-16 01:05:38 +01:00
Vincent Driessen 652ced2580 Add sources of inspiration. 2011-11-16 00:37:59 +01:00
Vincent Driessen f15f6d7843 Fix terminology. 2011-11-15 23:31:53 +01:00
Vincent Driessen 83e29ca987 Document how to start a worker. 2011-11-15 23:00:55 +01:00
Vincent Driessen 22f3da1832 Update README (and example). 2011-11-15 22:45:51 +01:00
Vincent Driessen 1a893e60cf Have work() return whether work has been done, or not.
And promote Worker to the rq namespace, so you can
    from rq import Worker
2011-11-15 22:44:17 +01:00
Vincent Driessen 1c9fa66bc1 Greatly simplify the setup.
Jobs don't even need to be tagged.  Any function can be put on queues.
2011-11-15 21:18:35 +01:00
Vincent Driessen 62b6b180f3 Also allow args and kwargs to enqueue() calls on Queue. 2011-11-15 09:36:38 +01:00
Vincent Driessen 159eba6df2 Add arg to test case. 2011-11-15 09:36:35 +01:00
Vincent Driessen fc5097ce7a Better test naming. 2011-11-15 09:36:32 +01:00
Vincent Driessen 196a9815d2 Add dequeue method to Queue. 2011-11-15 09:36:29 +01:00
Vincent Driessen b5e0377eb0 Allow jobs to be declared without a default queue.
This makes it impossible to use delay() on them.  Instead, you should
use enqueue().
2011-11-15 09:36:18 +01:00
Vincent Driessen 407f3e8b38 Add ability to put work on alternate queues. 2011-11-15 08:38:12 +01:00
Vincent Driessen 1b8da4a861 Add test for putting work on queues. 2011-11-15 08:13:16 +01:00
Vincent Driessen 8dfdd452ef Bugfix.
Yeah, it's getting late.

It's my own fault.

I know.
2011-11-15 01:34:38 +01:00
Vincent Driessen 04c88577ed Bugfix: LPOP does not support multiple queue arguments.
Redis' BLPOP command takes multiple queue arguments, but LPOP can only
take a single queue.  Therefore, we need to loop over all queues
manually, in order, and raise an exception is no more work is available.
2011-11-15 01:31:49 +01:00
Vincent Driessen a77c3d9104 Support quitting when all work is done (i.e. queue is empty). 2011-11-15 01:04:44 +01:00
Vincent Driessen 8dc2b15a6e Remove empty file.
It is obsoleted by rq/proxy.py
2011-11-15 00:50:44 +01:00
Vincent Driessen 0459134df3 Update header style. 2011-11-15 00:38:13 +01:00
Vincent Driessen ca99cd911a Doc changes. 2011-11-15 00:36:17 +01:00
Vincent Driessen 98ffcd8e05 Create soft dependency on logbook. 2011-11-15 00:35:56 +01:00
Vincent Driessen cd31f6aba9 Adapt examples so they run again.
Remove sync part of the example.
2011-11-15 00:35:18 +01:00
Vincent Driessen 56fc74118e Get rid of the formal definition. We're not a lawyer agency here. 2011-11-15 00:22:24 +01:00
Vincent Driessen 227e107a82 Oops, fix some old references to current_connection. 2011-11-14 22:26:43 +01:00
Vincent Driessen d721f0708b Refactor the whole Redis connection stuff to be just as easy as in RDB. 2011-11-14 21:32:49 +01:00
Vincent Driessen 5c4163400e Update README.md 2011-11-14 18:40:12 +01:00
Vincent Driessen 5be9a41f3d Getting the facts right, here. 2011-11-14 18:35:41 +01:00
Vincent Driessen 9b51083fd2 Add example and README updates. 2011-11-14 15:15:05 +01:00
Vincent Driessen 05e83c5231 Add a very minor beginning to the test cases. 2011-11-14 14:18:21 +01:00
Vincent Driessen 518db8c24b Add better connection management.
To start using RQ, push a Redis connection up its stack, like so:

    from rq import push_connection
    push_connection(Redis())
2011-11-14 14:17:30 +01:00
Vincent Driessen d8d388c841 Log the results of jobs. 2011-11-14 12:24:48 +01:00
Vincent Driessen f21b2af2b6 Make it an actual PyPI-managable Python package. 2011-11-14 12:16:28 +01:00
Vincent Driessen c45e056786 Add some project meta stuff. 2011-11-14 12:11:58 +01:00
Vincent Driessen 5eadd5ef52 Factor out a Queue object.
It might be useful to add some methods to that object, later.
2011-11-14 09:40:58 +01:00
Vincent Driessen 834a79814e Rename task -> job.
Just a gift from a non-mainframe guy to a mainframe guy.  Love is all
about giving ;)
2011-11-13 22:32:35 +01:00
Vincent Driessen a5a8925608 Add an actual awesome worker structure.
To put messages on queues, use this:

    @job('normal')
    def foo(x, y):
        return x + y

    foo.delay(4, 5)

To run workers, start any number of these:

    $ python runworker.py high normal low

You can give arbitrary queue names, they are not limited to these
priority-based names.  They just serve as a useful example.
2011-11-13 22:19:09 +01:00
Vincent Driessen 606f7f7cb3 Fix expire call. 2011-11-13 14:59:34 +01:00
Vincent Driessen 374c95f7a2 It ain't *that* naive ;) 2011-11-12 13:29:26 +01:00